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

David Feuer david.feuer at gmail.com
Thu Apr 30 19:23:15 UTC 2015


As usual, it depends on what aspects of behavior you consider important. As
an obvious example, if the two produce (or store) distinct structures that
are (==), that should be fine. Similarly, if the effects are different in a
way that does not matter to your application (e.g., one may buffer more
input than the other, or they may read from the same files in different
orders, or they may produce the same images on screen using different
graphics operations) then that should be fine too.
On Apr 30, 2015 11:45 AM, "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/4731cdfc/attachment.html>


More information about the Haskell-Cafe mailing list