A more flexible mtl
Haskell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Control/Monad
tests Fix all warnings Feb 16, 2017
.travis.yml
CONTRIBUTING.md
LICENSE Initial code Jun 8, 2014
README.md Clarify the status of this repo Jul 12, 2015
Setup.hs
monad-classes.cabal
stack.yaml

README.md

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.

    Example:

    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 Θ(n2) 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.

The status of this repo

This repo serves two purposes:

While this is technically open source software, I am not interested in maintaining this as an active open project. In practice this means that:

  • this version of monad-classes is not on hackage
  • I do not accept feature requests and pull requests. The exception is outright bugs; if you find any, please do report them.

There is a hackage package and a repo maintained by M Farkas-Dyck.