monad-classes: more flexible mtl

[ control, deprecated, library, mit ] [ Propose Tags ] [ Report a vulnerability ]
Deprecated

Downloads

Maintainer's Corner

Package maintainers

  • No current members of group

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.3, 0.3.0.1, 0.3.1.0, 0.3.1.1, 0.3.2.0, 0.3.2.1, 0.3.2.2
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]
Tested with ghc ==8.0.2, ghc ==8.2.2, ghc ==8.4.2
License MIT
Author Roman Cheplyaka <roma@ro-che.info>
Maintainer M Farkas-Dyck <strake888@gmail.com>
Category Control
Home page https://github.com/strake/monad-classes.hs
Uploaded by MatthewFarkasDyck at 2018-05-07T04:02:44Z
Distributions NixOS:0.3.2.2
Reverse Dependencies 7 direct, 0 indirect [details]
Downloads 5335 total (11 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-05-07 [all 1 reports]

Readme for monad-classes-0.3.2.2

[back to package description]

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.