|
|
|
|
|
by mavelikara
2986 days ago
|
|
Agree that monads don't compose. I am not the OP, and not a Haskell programer, but my understanding is that Monad Transformers exist because Monads don't compose, and when you want monadic effects to compose, you use Monad Transformers (the other option is a go crazy writing every combination and ordering of effects you want by hand). I got this impression from the papers I have read, particularly this one [1] Monad transformers offer an additional benefit to monadic
programming: by providing a library of different monads and
types and functions for combining these monads, it is possible
to create custom monads simply by composing the necessary monad
transformers. For example, if you need a monad with state and
error handling, just take the StateT and ErrorT monad transformers
and combine them.
Notice the last line of the snippet I posted above. What am I missing?[1]: Monad Transformers Step by Step https://page.mi.fu-berlin.de/scravy/realworldhaskell/materia... |
|