I've been watching Philip Wadler videos over and over again to get a handle on monads. But a question has arisen that I can't find an easy answer to.
Is there in general an easy way to combine multiple monads together?
On 15 Sep 2019, luserdroog wrote:
I've been watching Philip Wadler videos over and over again to get a handle on monads. But a question has arisen that I can't find an easy answer to. Is there in general an easy way to combine multiple monads together?
https://wiki.haskell.org/Lifting#Monad_lifting - "lifting" is the term
in Haskell for combining monads. Then one becomes the "inner" one and
the other the "outer" one. There's some broader discussion at https://mmhaskell.com/blog/2017/3/6/making-sense-of-multiple-monads
I'd guess that some analogy of the approach may work for you but it's
too early on a Monday morning for me to be able to say more than that!
-- Mark
I've been watching Philip Wadler videos over and over again to get a handle on monads. But a question has arisen that I can't find an easy answer to.
Is there in general an easy way to combine multiple monads together?
Say I want both State *and* Output and I have a monad that produces output, can I add State transformations to it or do I have to rewrite the whole program?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 293 |
Nodes: | 16 (2 / 14) |
Uptime: | 235:52:16 |
Calls: | 6,624 |
Files: | 12,172 |
Messages: | 5,319,769 |