Safe Haskell | Trustworthy |
---|---|

Language | Haskell2010 |

Lazy state effect

- data State s w = State (s -> s) (s -> w)
- get :: (Typeable e, Member (State e) r) => Eff r e
- put :: (Typeable e, Member (State e) r) => e -> Eff r ()
- modify :: (Typeable s, Member (State s) r) => (s -> s) -> Eff r ()
- runState :: Typeable s => s -> Eff (State s :> r) w -> Eff r (s, w)
- evalState :: Typeable s => s -> Eff (State s :> r) w -> Eff r w
- execState :: Typeable s => s -> Eff (State s :> r) w -> Eff r s

# Documentation

Strict state effect

State (s -> s) (s -> w) |

modify :: (Typeable s, Member (State s) r) => (s -> s) -> Eff r () Source

Transform the state with a function.

:: Typeable s | |

=> s | Initial state |

-> Eff (State s :> r) w | Effect incorporating State |

-> Eff r (s, w) | Effect containing final state and a return value |

Run a State effect.