As a math student, the first thing I did when I learned about monads in Haskell was check that they really were monads in the sense I knew about. But then I learned about monad transformers and those don't quite seem to be something studied in category theory.
In particular I would expect them to be related to distributive laws but they seem to be genuinely different: a monad transformer is expected to apply to an arbitrary monad while a distributive law is an affair between a monad and a specific other monad.
Also, looking at the usual examples of monad transformers, while MaybeT m
composes m
with Maybe
, StateT m
is not a composition of m
with State
in either order.
So my question is what are monad transformer in categorical language?
Monad transformers aren't exceedingly mathematically pleasant. However, we can get nice (co)products from free monads, and, more generally, ideal monads: See Ghani and Uustalu's "Coproducts of Ideal Monads": http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.2698
Calculating monad transformers with category theory by Oleksandr Manzyuk is another article on the Monad transformers, and relates the concept to the important concept of adjunction in the category theory.
Also it uses the most pleasant feature of the category theory, in my opinion, i.e. diagram-chasing, which naturalises the concept a lot.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With