<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Dec 14, 2011, at 12:37 PM, Bryan O'Sullivan wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Tue, Dec 13, 2011 at 10:23 PM, Gregory Crosswhite <span dir="ltr">&lt;<a href="mailto:gcrosswhite@gmail.com">gcrosswhite@gmail.com</a>&gt;</span> wrote:<br><div>&nbsp;&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>This way users of the classes will know whether their type has well-defined instance for some and many or not.</div></div></blockquote><div><br></div><div>But that's <i>precisely</i> what the Alternative class is already for! If&nbsp;you are writing an Alternative instance <i>at all</i>, then you are asserting that it <i>must</i>&nbsp;be possible and reasonable to replicate the existing behaviour of&nbsp;some and many.</div>
</div></blockquote><br></div><div>It seems reasonable to say that 'empty' and '&lt;|&gt;' are what Alternative is for, and 'some' and 'many' happen to be useful compositions of those for several (but not all) Alternatives - just like there are compositions of the Monad operations that don't make sense in all monads (such as "forever"), there are compositions of the Alternative operations that don't make sense for all Alternatives. &nbsp;It just happens that "some" and "many" are important enough for parsing that it was felt worthwhile to put them in the class to allow optimizing them in some cases.</div><div><br></div><div>So a case could be made that, just as "forever (Just 1)" being nonsensical doesn't invalidate "instance Monad Maybe", "some (Just 1)" being nonsensical doesn't invalidate "instance Alternative Maybe". &nbsp;And on the other hand, a case could be made that the importance of "some" and "many" justifies the creation of a subclass of Alternative where they actually are mandated to be meaningful rather than just definable.</div><div><div class="gmail_quote"><div><br></div><div><div class="gmail_quote"><div></div><blockquote type="cite"><div>I think we should take any further discussion off-list. Your messages from last night betray a deep misunderstanding that I'm not sure everyone else needs to sit through :-)</div></blockquote><div><br></div><div>Obviously I can't speak for everyone, but I enjoy reading discussions like this (and with a threaded mail reader, they're very easy to skip when I don't feel like reading them). &nbsp;What seems like misunderstanding is often actually another person's fundamental difference of perspective, and it can be valuable to anyone who has skimmed the thread this far to see what, if any, common ground can be found.</div><div><br></div></div></div></div></div><div>-- James</div><br></body></html>