Safe Haskell | Safe-Inferred |
---|---|

Language | Haskell2010 |

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 b`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.

Stateful (b, a) |

Functor (Stateful a) | |

Monoid a => Applicative (Stateful a) | |

(Eq a, Eq b) => Eq (Stateful a b) | |

(Ord a, Ord b) => Ord (Stateful a b) | |

(Show a, Show b) => Show (Stateful a b) | |

(Monoid a, IsString b) => IsString (Stateful a b) | |

(Monoid a, Monoid b) => Monoid (Stateful a b) | |

(PositiveMonoid a, PositiveMonoid b) => PositiveMonoid (Stateful a b) | |

(MonoidNull a, MonoidNull b) => MonoidNull (Stateful a b) | |

(StableFactorialMonoid a, StableFactorialMonoid b) => StableFactorialMonoid (Stateful a b) | |

(FactorialMonoid a, FactorialMonoid b) => FactorialMonoid (Stateful a b) | |

(RightGCDMonoid a, RightGCDMonoid b) => RightGCDMonoid (Stateful a b) | |

(LeftGCDMonoid a, LeftGCDMonoid b) => LeftGCDMonoid (Stateful a b) | |

(RightReductiveMonoid a, RightReductiveMonoid b) => RightReductiveMonoid (Stateful a b) | |

(LeftReductiveMonoid a, LeftReductiveMonoid b) => LeftReductiveMonoid (Stateful a b) | |

(LeftGCDMonoid a, FactorialMonoid a, TextualMonoid b) => TextualMonoid (Stateful a b) |