haskell - Is it really a default practice to make every monad transformer an instance of MonadTrans? -
so real world haskell says:
every monad transformer instance of monadtrans
but i'm playing scotty , found out base monad transformer scottyt not instance of monadtrans.
looking @ release notes seems deliberate design decision: here. quote:
the monad parameters scottyt have been decoupled, causing type of scottyt constructor change. result, scottyt no longer monadtrans instance ...
i hope understand confusion. nevertheless, try formulate strict questions:
- why 1 not want monad transformer instance of
monadtrans? - how explain aforementioned change in scottyt design?
p.s.: understand can define instance of monadtrans scottyt myself, should i? (links questions)
scottyt not monad transformer. let's inline (simplified) definition:
newtype scottyt' m = scottyt' { runs :: state [ (request->m response) -> request->m response ] } to define lift need, general m a action , such middlewares list, have obtain actual a value, because state s yields actual unmonadic values. there's no way that.
now, if argue monadtrans isn't required monad transformer: mathematically speaking, monad transformers correspond composition of functors, scottyt doesn't implement such composition.
Comments
Post a Comment