Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Example of large Monad stack

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?

like image 563
nudded Avatar asked Oct 12 '12 06:10

nudded


1 Answers

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...

like image 164
Peter Wortmann Avatar answered Sep 21 '22 12:09

Peter Wortmann