The monad-classes package

[Tags:library, mit, test]

[Skip to Readme]


Versions 0.3,,,,
Dependencies base (>=4.7 && <5), ghc-prim, mmorph (>=1.0.3), monad-control (>=1), peano (>=0.1), reflection (>=1.4), transformers (>=0.2), transformers-base (>=0.4.2), transformers-compat (>=0.3.1) [details]
License MIT
Author Roman Cheplyaka <>
Maintainer M Farkas-Dyck <>
Stability Unknown
Category Control
Home page
Uploaded Fri Jan 13 02:20:07 UTC 2017 by MatthewFarkasDyck
Distributions NixOS:
Downloads 528 total (14 in the last 30 days)
0 []
Status Docs available [build log]
Last success reported on 2017-01-13 [all 1 reports]




Maintainer's Corner

For package maintainers and hackage trustees

Readme for monad-classes

Readme for monad-classes-

Build Status

See this series of articles for the detailed description and motivation.

This is a more flexible version of mtl, the monad transformers library.

  • You can have many layers of e.g. state transformers in your stack, and you don't have to explicitly lift your gets and puts, as soon as different state transformers carry different types of states.


    a :: (MonadState Bool m, MonadState Int m) => m ()
    a = do
      put False -- set the boolean state
      modify (+ (1 :: Int)) -- modify the integer state
  • mtl requires Θ(n<sup>2</sup>) instances (like MonadReader e (StateT s m)); monad-classes requires only Θ(n) of them (where n is the number of different transformer types).

    If you'd like to define your own monad-classes-style class, you have to write much less boilerplate code.