 | ProbabilityMonads-0.1.0: Probability distribution monads. | Contents | Index |
|
Control.Monad.MonoidValue | Portability | non-portable (multi-parameter type classes, undecidable instances) | Stability | experimental |
|
|
|
Description |
This module provides stripped-down versions of
Writer and WriterT, minus the
operations tell, listen and
pass. It a useful building block for monads
representing probability distributions or quantum states, where the extra
functions provided by MonadWriter are
irrelevant or inappropriate.
The MV monad and the MVT monad transformer were proposed by Dan Piponi
as a way of representing M-sets in Haskell. An M-set is a set with a
monoid action (by analogy to the more common G-sets found in group theory).
Here, MV represents an element in a free M-set. This is essentially a
(monoid,value) pair.
- Computation type:
- Computations with an associated monoid action.
- Binding strategy:
- The return function lifts a value into the monad by
pairing it with mempty. The bind function uses mappend to implement
the monoid action.
- Useful for:
- Building probability distribution monads.
|
|
Synopsis |
|
|
|
Documentation |
|
module Data.Monoid |
|
data MV w a |
A value annotated with a monoid. Represents an element in a free
M-set.
| Constructors | MV | | mvMonoid :: w | | mvValue :: a | |
|
| Instances | |
|
|
mvMonoid :: MV w a -> w |
|
mvValue :: MV w a -> a |
|
newtype MVT w m a |
Transforms a monad m to associate a monoid value with the
computation.
| Constructors | | Instances | |
|
|
runMVT :: MVT w m a -> m (MV w a) |
|
Produced by Haddock version 0.8 |