[Haskell-cafe] Is it acceptable if Applicative behave not like a Monad
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.
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe