[Haskell-cafe] Haskell-Cafe Digest, Vol 217, Issue 16

Viktor Dukhovni ietf-dane at dukhovni.org
Mon Sep 20 04:17:26 UTC 2021

> On 19 Sep 2021, at 8:24 pm, Richard Eisenberg <lists at richarde.dev> wrote:
> This was all clear enough. What I didn't understand is why there was a typeclass to capture this or why we needed other monads -- until I associated "monad" with "programmable semicolon". At that point, I realized that the idea is very powerful.

Thus, e.g., the Hasql library (and of course also STM before that)
leverage the ability to define a specialised Monad in which only
specific "impure" actions are available to be able to "retry" a
(Postgres Database in the case of Hasql) transaction, without worrying
about side-effects persisting from the initial attempt.

The Conduit and Streaming ecosystems are also testaments to the
effectiveness of the abstraction.

And then there's always State, which e.g. makes it possible to
define mapAccumL and mapAccumR for all Traversable structures,
or more generally thread an evolving through a sequence pure

Thus while there's reportedly been a shift lately from multi-layered
Monad Transformer stacks to RIO or algebraic effect systems, Monads
remain powerful and useful tools.

I no longer remember exactly when they "clicked" for me, perhaps there
wasn't any "Aha" moment.  Just growing familiarity through multiple
exposures to the many use-cases.

Still haven't used "Cont" at all, so don't have any intuition for
whether/when/how I might put it to good use...  If someone wrote
a good overview for that module, I'd be happy to learn more.


More information about the Haskell-Cafe mailing list