<div dir="ltr">Why can't the library provide a `newtype`, one which supports `Applicative` *and* `Monad` interfaces (where the applicative and monadic interfaces match), and an un-newtyped variant that only supports `Applicaative`, as well as conversion functions?<div><br></div><div>I think this would be clearer, as it would force you to switch into "Monad"-mode purposefully, and the documentation on the conversion function can make very clear what is going on.</div><div><br></div><div>I agree that, now that we have AMP, applicative and monadic interfaces absolutely *should* match, and that it should be considered an error for them not to; semantically different interfaces can be provided with newtypes.</div><div><br></div><div>-- Andrew</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 30, 2015 at 6:46 PM, Omari Norman <span dir="ltr"><<a href="mailto:omari@smileystation.com" target="_blank">omari@smileystation.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class="">On Thu, Apr 30, 2015 at 1:32 PM, Nikita Volkov <span dir="ltr"><<a href="mailto:nikita.y.volkov@mail.ru" target="_blank">nikita.y.volkov@mail.ru</a>></span> wrote:<br></span><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I'm afraid I have to disagree with Adam as well. Recently I've triggered a prolonged discussion on exactly the subject (<a href="https://github.com/ekmett/either/pull/38" target="_blank">https://github.com/ekmett/either/pull/38</a>). Being originally convinced that the instances can behave however it fits, I think I've been over-persuaded in the end.<div><br></div><div>Shortly speaking, while I can't say I like it, the rule seems to be that `<*>` should produce the same side effects as Monad's `ap`.<div><br></div></div></div></blockquote><div><br></div></span><div>One example of a library where the Applicative and Monad instances mismatch is uu-parsinglib.</div><div><br></div><div><a href="http://stackoverflow.com/questions/18275123/cannot-compute-minimal-length-of-a-parser-uu-parsinglib-in-haskell/18292328#18292328" target="_blank">http://stackoverflow.com/questions/18275123/cannot-compute-minimal-length-of-a-parser-uu-parsinglib-in-haskell/18292328#18292328</a><br></div><div><br></div><div>There's a good reason the library is this way but the behavior can be rather startling.</div></div></div></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>