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@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@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe