talira

The Monad Transformer Library

open sourceBSD-3-Clausefree

mtl is the Haskell library of monad classes for monad transformers. It extends transformers with type classes such as MonadState, MonadReader, MonadWriter, MonadError and MonadCont that use functional dependencies to lift operations through a stack of transformers automatically, so code can call get or throwError without writing lift for each layer. Its modules (Control.Monad.State, Reader, Writer, Except, RWS, Cont, Accum and Select) re-export the transformers' data types with instances for every class.

Problems it solves

  • stop writing lift lift everywhere in my Haskell monad transformer stack
  • write Haskell functions that work in any monad with state or errors
  • combine reader, state and error handling in one Haskell monad

Features

  • MonadState, MonadReader, MonadWriter, MonadError and MonadCont classes
  • automatic lifting through transformer stacks
  • Control.Monad.RWS combined reader-writer-state
  • CPS variants of Writer and RWS
  • instances for the transformers package's types

Alternatives

The same job

These do what mtl does.

  1. transformers Concrete functor and monad transformers for Haskell

Compare mtl with the top 3