Wrangling Monad Transformer Stacks
Why Stack Overflow recommends it
Stack Overflow users link it when answering questions about structuring large Haskell programs and writing generic lift code over monad transformer stacks.
Recommended by 2 people across 2 different months, 2010 to 2017.
What it is
A talk by Brian Hurt at the New York Haskell Meetup (August 2015) on managing monad transformer stacks in real-world Haskell programs. It introduces several libraries that make lifting actions through custom monad stacks easier.
What people said
Recommends liminalisht · 2016-04 · Stack Overflow · on “Large-scale design in Haskell?”
@Lii Ben Kolera [LINK] gives a great practical intro to this topic, and Brian Hurt [this video] discusses solutions to the problem of `lift`ing monadic actions into your custom monad. George Wilson [LINK] shows how to use `mtl` to write code that works with any monad that implements the required typeclasses, rather than your custom monad kind. Carlo Hamalainen [LINK] has written some short, useful notes summarizing George's talk.
Recommends castletheperson · 2017-06 · Stack Overflow · on “Generic Lift Class”
There are a few libraries which do this. You may find this YouTube video [this video] interesting, in particular starting at 13:01.
Cites user349653 · 2010-06 · Stack Overflow · on “Large-scale design in Haskell?”
Don gave you most of the details above, but here's my two cents from doing really nitty-gritty stateful programs like system daemons in Haskell. In the end, you live in a monad transformer stack. At the bottom is IO. Above that, every major module (in the abstract sense, not the module-in-a-file sense) maps its necessary state into a layer in that stack. So if you have your database connection code hidden in a module, you write it all to be over a type MonadReader Connection m => ... -> m ... and then your database functions can always get their connection without functions from other modules having to be aware of its existence. You might end up with one layer carrying your database connecti