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

John Wiegley johnw at newartisans.com
Wed Jun 15 17:29:34 UTC 2016


>>>>> 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


More information about the Haskell-Cafe mailing list