[Haskell-cafe] Is it acceptable if Applicative behave not like a Monad

Nikita Volkov nikita.y.volkov at mail.ru
Thu Apr 30 17:32:54 UTC 2015

I'm afraid I have to disagree with Adam as well. Recently I've triggered a
prolonged discussion on exactly the subject (
https://github.com/ekmett/either/pull/38). Being originally convinced that
the instances can behave however it fits, I think I've been over-persuaded
in the end.

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`.

The most convincing argument I've seen so far against the two digressing is
that it can cause unexpected behaviour of the "do" notation (
https://github.com/ekmett/either/pull/38#issuecomment-95695814), but you'll
find plenty of other arguments in the discussion as well.

Best regards,
Nikita Volkov

2015-04-30 19:07 GMT+03:00 Kim-Ee Yeoh <ky3 at atamo.com>:

> On Thu, Apr 30, 2015 at 10:49 PM, Adam Bergmark <adam at bergmark.nl> wrote:
>> Yes it's okay and sometimes expected for them not not behave the same,
>> but see e.g. haxl and ApplicativeDo.
> This is a value of okay I've never seen before.
>> For example, the applicative version may run foo and bar in parallell.
>> But using monad they run sequentially.
> What if pure weren't a perfect synonym for return?
> What if the methods of the semigroup instance didn't match those of the
> monoid?
> The mind boggles at the confusion that would result.
> Such cases typically call for newtypes to sort out the effect classes.
> -- Kim-Ee
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150430/00834b20/attachment.html>

More information about the Haskell-Cafe mailing list