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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -