Reader monad, categorically - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Pedro Minicz

How would I describe monads such as MonadReader or MonadState or even Applicative in the language of category theory? When searching for these I only find their functional programming description (even Applicative, which I would expect to be easy to find a categorical description).

Georgi Lyubenov // googleson78

applicative is a "monoidal functor" afaiu

Pedro Minicz

Cool! For future reference:

Unlike monads, which came into programming straight from category theory, applicative functors have their origins in programming. McBride and Paterson introduced applicative functors as a programmi…
Pedro Minicz

Still, it would be interesting to figure if there is a good description of MonadReader in the language of category theory.

Torsten Schmits

something like a monad in the Hom category

TheMatten

I guess Reader is just a function, and MonadX constraints are sort of "proofs" of monad transformers being composable with X monad?

Torsten Schmits

right so the question is whether @Pedro Minicz meant ReaderT or specifically MonadReader

Pedro Minicz

MonadReader specifically.

Pedro Minicz

Torsten Schmits said:

something like a monad in the Hom category

Which hom-category? As far as I know, a hom-category is the category between 0-cells in a 2-category.

Pedro Minicz

I believe I haven't heard anyone talk about about the "2-category of endofunctors," which is the context in which monad are usually discussed. What should the 2-cells be?

Kim-Ee Yeoh

Check out the last issue of The Monad Reader, published in March 2009, which answers the question "where do the common fundamental monads of Haskell, such as State, Reader, Writer, List, and Maybe, come from?" in the article by Derek Elkins.

https://wiki.haskell.org/wikiupload/8/85/TMR-Issue13.pdf