[Haskell-cafe] Is it acceptable if Applicative behave not like a Monad
Adam Bergmark
adam at bergmark.nl
Thu Apr 30 15:49:57 UTC 2015
Yes it's okay and sometimes expected for them not not behave the same, but
see e.g. haxl and ApplicativeDo.
For example, the applicative version may run foo and bar in parallell. But
using monad they run sequentially.
- Adam
On Thu, Apr 30, 2015 at 5:45 PM, Alexey Uimanov <s9gf4ult at gmail.com> wrote:
> Hello, I have such a question: assume you have some type `T` which has
> Applicative and Monad instances. Is it ok if code like this:
>
> foo :: Int -> T String
> bar :: Int -> T Int
>
> (,) <$> foo 10 <*> bar "20"
>
> behaves not like this code:
>
> foobar = do
> x <- foo 10
> y <- bar "20"
> return (x, y)
>
> The word "behaves" I mean not just returning value but the effect
> performed also.
>
>
> _______________________________________________
> 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/4940b200/attachment.html>
More information about the Haskell-Cafe
mailing list