ekmett / kan-extensions

Kan extensions, Kan lifts, the Yoneda lemma, and (co)monads generated by a functor
Other
79 stars 33 forks source link

Implement MonadWriter for Codensity #61

Closed Atry closed 11 months ago

Atry commented 4 years ago

It should be much faster than WriterT, because we don't need to transform the whole stack for every operator.

Also ReaderT has a simpler implementation than WriterT.

ekmett commented 11 months ago

Codensity of a reader monad is more powerful than that. It has the full strength of State not just Writer, and we separate those effects in the mtl discipline -- otherwise MonadState would have Reader (and possibly Writer) as superclasses.