[Haskell-cafe] On finding the right exposition... (Monads)
ietf-dane at dukhovni.org
Fri Sep 17 20:50:25 UTC 2021
On Fri, Sep 17, 2021 at 10:29:41PM +0200, Joachim Durchholz wrote:
> > Unsurpsingly, I have a mental model built around sequencing of internal
> > state updates while passing data from one state to use in choosing the
> > next state transition.
> I have been finding the Monad expositions misleading - that idea that
> monads are for sequencing or transitions or mutable state always felt
> wrong to me, since the monad laws don't talk about any of these things
> at all.
That's the nature of mental models, they're first approximations with
possible refinements. Yes, there are monads for which State is a poor
analogy. The `Cont` monad comes to mind, one needs to "think different"
when reasoning about `callCC`, `shift` and `reset`
`State` as a mental model for monads captures basic sequencing with
possible internal "effects" well enough to be a reasonable first
approximation. Already with List exploring all possible paths the
fit is not ideal.
More information about the Haskell-Cafe