| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Data.Monoid.Instances.Stateful
Description
This module defines the monoid transformer data type Stateful.
> let s = setState [4] $ pure "data" :: Stateful [Int] String
> s
Stateful ("data",[4])
> factors s
[Stateful ("d",[]),Stateful ("a",[]),Stateful ("t",[]),Stateful ("a",[]),Stateful ("",[4])]Documentation
is a wrapper around the Stateful a bMonoid b that carries the state a along. The state type a must be
a monoid as well if Stateful is to be of any use. In the FactorialMonoid and TextualMonoid class instances, the
monoid b has the priority and the state a is left for the end.
Constructors
| Stateful (b, a) |
Instances