As the title says, I'm looking for a program that uses monad-transformers in combination with a large stack of Monads.
Does anybody know a real-world example?
As the title says, I'm looking for a program that uses monad-transformers in combination with a large stack of Monads.
Does anybody know a real-world example?
One good example is Haskeline - its internal InputCmdT
type is a monad transformer stack of depth 6 (see here):
type InputCmdT m = StateT Layout (UndoT (StateT HistLog (ReaderT (IORef KillRing)
(ReaderT Prefs (ReaderT (Settings m) m)))))
Which can actually have curious effects, such as blowing one type signature in System.Console.Haskeline.Emacs up to over 20.000 lines for at least one GHC version...
I don't know if this counts as "real world", but in my extension of the tutorial Write Yourself a Scheme in 48 Hours I implemented an interpreter for a programming language that uses the following stack:
type Eval a = ReaderT Environment (ErrorT LispError IO a)
and I begun adding continuations to the language by defining
type EvalCont r a = ContT r (ReaderT Environment (ErrorT LispError IO a))
I never finished implementing continuations, but you can see how far I got by checking it out on Github.