Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Bluefin.StateSource
Synopsis
- data StateSource (st :: Effects)
- withStateSource :: forall (es :: Effects) a. (forall (e :: Effects). StateSource e -> Eff (e :& es) a) -> Eff es a
- newState :: forall (e :: Effects) s (es :: Effects). StateSource e -> s -> Eff es (State s e)
Documentation
A StateSource
allows you to allocate new
State
handles, much like ST
allows you to allocate new STRef
s. This can be
useful when you want to avoid nested runState
(or evalState
blocks), or you need an only
dynamically known number of mutable states.
Handle
data StateSource (st :: Effects) #
Handle to a capability to create strict mutable state handles
Handlers
Effectful operations
Arguments
:: forall (e :: Effects) s (es :: Effects). StateSource e | |
-> s | The initial value for the state handle |
-> Eff es (State s e) | A new state handle |