free: Monads for free

[ bsd3, control, library, monads ] [ Propose Tags ] [ Report a vulnerability ]

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/


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0, 0.1.1, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 1.8.0, 1.8.0.1, 1.8.0.3, 1.8.0.4, 2.0, 2.0.1, 2.0.1.1, 2.0.2, 2.0.3, 2.1, 2.1.1, 2.1.1.1, 2.2, 3.0, 3.1, 3.1.1, 3.2, 3.3, 3.3.0.1, 3.3.0.2, 3.3.1, 3.4, 3.4.1, 3.4.2, 4.0, 4.1, 4.2, 4.4, 4.5, 4.6, 4.6.1, 4.7, 4.7.1, 4.8, 4.8.0.1, 4.9, 4.10.0.1, 4.11, 4.12, 4.12.1, 4.12.2, 4.12.3, 4.12.4, 5, 5.0.1, 5.0.2, 5.1, 5.1.1, 5.1.2, 5.1.3, 5.1.4, 5.1.5, 5.1.6, 5.1.7, 5.1.8, 5.1.9, 5.1.10, 5.2 (info)
Change log CHANGELOG.markdown
Dependencies base (>=4.9 && <5), bifunctor-classes-compat (>=0.1 && <0.2), comonad (>=5.0.8 && <6), containers (>=0.5.7.1 && <0.8), distributive (>=0.5.2 && <1), exceptions (>=0.10.4 && <0.11), indexed-traversable (>=0.1.1 && <0.2), mtl (>=2.2.2 && <2.4), profunctors (>=5.6.1 && <6), semigroupoids (>=5.3.5 && <7), template-haskell (>=2.11 && <2.23), th-abstraction (>=0.4.2.0 && <0.8), transformers (>=0.5 && <0.7), transformers-base (>=0.4.5.2 && <0.5) [details]
Tested with ghc ==8.0.2, ghc ==8.2.2, ghc ==8.4.4, ghc ==8.6.5, ghc ==8.8.4, ghc ==8.10.7, ghc ==9.0.2, ghc ==9.2.6, ghc ==9.4.4, ghc ==9.6.1
License BSD-3-Clause
Copyright Copyright (C) 2008-2015 Edward A. Kmett
Author Edward A. Kmett
Maintainer Edward A. Kmett <ekmett@gmail.com>
Revised Revision 5 made by ryanglscott at 2024-05-16T11:05:55Z
Category Control, Monads
Home page http://github.com/ekmett/free/
Bug tracker http://github.com/ekmett/free/issues
Source repo head: git clone git://github.com/ekmett/free.git
Uploaded by ryanglscott at 2023-03-12T18:42:24Z
Distributions Arch:5.1.10, Debian:5.1.3, Fedora:5.1.10, FreeBSD:4.12.1, LTSHaskell:5.2, NixOS:5.2, Stackage:5.2, openSUSE:5.2
Reverse Dependencies 204 direct, 8020 indirect [details]
Downloads 259396 total (514 in the last 30 days)
Rating 2.5 (votes: 5) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-03-12 [all 1 reports]

Readme for free-5.2

[back to package description]

free

Hackage Build Status

This package provides a common definitions for working with free monads, free applicatives, and cofree comonads in Haskell.

Contact Information

Contributions and bug reports are welcome!

Please feel free to contact me through github or on the #haskell IRC channel on irc.freenode.net.

-Edward Kmett