control-monad-free-0.5: Free monads and monad transformersSource codeContentsIndex

Naive Free monads suffer from a quadratic complexity, as explained in

  • Janis Voigtlander, Asymptotic Improvement of Computations over Free Monads, MPC'08

The solution is to redefine the Free datatype in CPS, similar to what is done in difference lists to solve the problem on quadratic append for lists.

newtype C mu a Source
C (forall b. (a -> mu b) -> mu b)
show/hide Instances
Functor f => MonadFree f (C (Free f))
Monad (C mu)
Functor (C mu)
MonadPlus mu => MonadPlus (C mu)
rep :: Monad mu => mu a -> C mu aSource
improve :: Monad mu => C mu a -> mu aSource
Produced by Haddock version 2.6.0