[Haskell-cafe] How to spot Monads, Applicatives ...

William Yager will.yager at gmail.com
Wed Jun 15 17:36:37 UTC 2016

>  If it makes sense to apply a "Foo of functions" to a value,

That's just a functor. "fmap ($ value) foos".

But yes, if you want to do this with more than one foo (or functions inside
a foo), then you need applicative.


(+) <$> [1,2,3] <*> [10,20,30]

On Wed, Jun 15, 2016 at 10:29 AM, John Wiegley <johnw at newartisans.com>

> >>>>> martin  <martin.drautzburg at web.de> writes:
> > I am at a stage, where I can use some of the Monads and Applicatives
> which
> > are out there. But I hardly ever wrote my own instances. I am curious to
> > learn about the thought processes which lead to the insight "hey that
> can be
> > written nicely as an Applicative Functor"
> When I realize Monad might be useful:
>   If it makes sense for a "Foo of Foos" (over some type) to be reduced to a
>   Foo.
> When I realize Applicative might be useful:
>   If it makes sense to apply a "Foo of functions" to a value, or a function
>   taking two or more arguments to two or more Foos, throughout those Foos.
> --
> John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
> http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2
> _______________________________________________
> 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/20160615/f5045381/attachment.html>

More information about the Haskell-Cafe mailing list