Package5.2ControlMonads
free
Monads for free
- Version5.2
- CategoryControl, Monads
- LicenceBSD-3-Clause
- AuthorEdward A. Kmett
- MaintainerEdward A. Kmett <ekmett@gmail.com>
- Homepagegithub.com/ekmett/free
- Pinned byhackage free 5.2
- Sourcehackage.haskell.org/package/free-5.2
Modules
19 modules- Control.Alternative.Free5Left distributive Alternative functors for free, based on a design
- Control.Alternative.Free.Final4Final encoding of free Alternative functors.
- Control.Applicative.Free7Applicative functors for free
- Control.Applicative.Free.Fast11A faster free applicative.
- Control.Applicative.Free.Final6Final encoding of free Applicative functors.
- Control.Applicative.Trans.Free18Applicative functor transformers for free
- Control.Comonad.Cofree14Cofree comonads
- Control.Comonad.Cofree.Class1
- Control.Comonad.Trans.Cofree10The cofree comonad transformer
- Control.Comonad.Trans.Coiter6The coiterative comonad generated by a comonad
- Control.Monad.Free15Monads for free
- Control.Monad.Free.Ap15"Applicative Effects in Free Monads" Often times, the (\<*\>) operator can be more efficient than ap.
- Control.Monad.Free.Church12"Free Monads for Less" The most straightforward way of implementing free monads is as a recursive
- Control.Monad.Free.Class3Monads for free.
- Control.Monad.Free.TH4Automatic generation of free monadic actions.
- Control.Monad.Trans.Free21The free monad transformer
- Control.Monad.Trans.Free.Ap20Given an applicative, the free monad transformer.
- Control.Monad.Trans.Free.Church22Church-encoded free monad transformer.
- Control.Monad.Trans.Iter16Based on Capretta's Iterative Monad Transformer Unlike Free, this is a true monad transformer.
Description
Free monads are useful for many tree-like structures and domain specific languages.
If f is a Functor then the free Monad on f is the type of trees whose nodes are labeled with the constructors of f. The word "free" is used in the sense of "unrestricted" rather than "zero-cost": Free f makes no constraining assumptions beyond those given by f and the definition of Monad. As used here it is a standard term from the mathematical theory of adjoint functors.
Cofree comonads are dual to free monads. They provide convenient ways to talk about branching streams and rose-trees, and can be used to annotate syntax trees. The cofree comonad can be seen as a stream parameterized by a Functor that controls its branching factor.
More information on free monads, including examples, can be found in the following blog posts: https://ekmett.github.io/reader/2008/monads-for-free/ https://ekmett.github.io/reader/2011/free-monads-for-less/
Depends on
13 packages- base-4.20.2.0with GHC
- comonad-5.0.9in this set
- containers-0.7with GHC
- distributive-0.6.2.1in this set
- exceptions-0.10.9with GHC
- indexed-traversable-0.1.4in this set
- mtl-2.3.1with GHC
- profunctors-5.6.3in this set
- semigroupoids-6.0.1in this set
- template-haskell-2.22.0.0with GHC
- th-abstraction-0.7.1.0in this set
- transformers-0.6.1.1with GHC
- transformers-base-0.4.6in this set