tag:blogger.com,1999:blog-1777990983847811806.post3246352678551094332..comments2018-04-20T08:38:02.099-07:00Comments on Haskell for all: The MonadTrans class is missing a methodGabriel Gonzaleznoreply@blogger.comBlogger5125tag:blogger.com,1999:blog-1777990983847811806.post-80940178569976367752012-09-26T18:26:01.563-07:002012-09-26T18:26:01.563-07:00What Edward is proposing is to have a class of *fu...What Edward is proposing is to have a class of *functorial* monad transformers (transformers which are endofunctors in the category Mon(C) of monads over a category C and monad morphisms) <br /><br />Note that some transformers, like the continuation monad transformer, are not functorial.<br /><br />Even less monad transformers are a monad in Mon(C) . In fact, I think it's only those arising from distributive laws of monads (error and reader).<br /><br />However, in the code above it is not clear when you mean a natural transformation between monads and when you mean a monad morphism.<br /> <br /><br />Maurohttps://www.blogger.com/profile/12330175633010569183noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-15449729661895478052012-09-21T08:08:17.073-07:002012-09-21T08:08:17.073-07:00He means for the case of StateT. StateT forms a s...He means for the case of StateT. StateT forms a sensible higher order functor (i.e. just mapT), but not a sensible higher order monad.Gabriel Gonzalezhttps://www.blogger.com/profile/01917800488530923694noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-51124622414619626002012-09-21T07:26:15.021-07:002012-09-21T07:26:15.021-07:00I don't see why/when embed forces you into sit...I don't see why/when embed forces you into situations where you need to randomly discard state. Can you elaborate a bit?byorgeyhttp://byorgey.wordpress.com/noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-6522465745909283502012-09-20T21:39:49.496-07:002012-09-20T21:39:49.496-07:00er. I meant monad homomorphisms, not natural trans...er. I meant monad homomorphisms, not natural transformations.<br /><br />It lifts a monad homomorphism from m to n into a monad homomorphism from t m to t n.Edward Kmetthttps://www.blogger.com/profile/16144424873202502715noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-40831077946819281342012-09-20T21:38:49.345-07:002012-09-20T21:38:49.345-07:00I don't believe embed is the right abstraction...I don't believe embed is the right abstraction.<br /><br />There is something very close to it that I do advocate, which I've called 'hoist' for a few years now:<br /><br />class MonadHoist t where<br /> hoist :: (Monad m, Monad n) => (forall a. m a -> n a) -> t m a -> t n a<br /><br />This represents the lifting of natural transformations into the transformer.<br /><br />Unlike embed, you aren't forced into situations where you need to randomly discard state, etc.<br /><br />The problem is, just like your proposed MonadTrans variant, it requires Rank2Types and therefore falls outside of the scope of the transformers which provides MonadTrans and is Haskell 98) and the MTL (which does not use Rank2Types)Edward Kmetthttps://www.blogger.com/profile/16144424873202502715noreply@blogger.com