monoid-subclasses-0.3.5: Subclasses of Monoid

Safe HaskellNone
LanguageHaskell2010

Data.Monoid.Instances.Stateful

Description

This module defines the monoid transformer data type Stateful.

Synopsis

Documentation

data Stateful a b Source

Stateful a b is a wrapper around the Monoid 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) 

inject :: Monoid a => b -> Stateful a b Source

extract :: Stateful a b -> b Source

state :: Stateful a b -> a Source

setState :: a -> Stateful a b -> Stateful a b Source