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

martin martin.drautzburg at web.de
Wed Jun 15 15:54:33 UTC 2016


Hello all,

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"

I suppose you can write everything without these type classes. Is it a promising approach to try without and then spot
an element of repetition and factoring out that naturally leads to one of these typeclasses?

Paticularly I am having difficulties with the *->* instances. E.g. why is the state "s" in the state monad the fixed
type and the "a" the type parameter? When I am writing state code without the State monad the two look like equal
candidates. Why not have "State a" monad, which threads an a-typed value and spits out states?

While we're at it: would someone be so kind and explain what exactly is meant by an "effect"? I know that in haskell
this is not the same as a "side effect" as there are no side-effects in haskell.


More information about the Haskell-Cafe mailing list