Safe Haskell | None |
---|---|
Language | Haskell2010 |
Most users should import Haxl.Core instead of importing this module directly.
Synopsis
- class Typeable f => StateKey (f :: * -> *) where
- data State f
- data StateStore
- stateGet :: forall r. StateKey r => StateStore -> Maybe (State r)
- stateSet :: forall f. StateKey f => State f -> StateStore -> StateStore
- stateEmpty :: StateStore
Documentation
class Typeable f => StateKey (f :: * -> *) where Source #
StateKey
maps one type to another type. A type that is an
instance of StateKey
can store and retrieve information from a
StateStore
.
getStateType :: Proxy f -> TypeRep Source #
We default this to typeOf1, but if f is itself a complex type that is already applied to some paramaters, we want to be able to use the same state by using typeOf2, etc
Instances
Typeable tag => StateKey (ConcurrentIOReq tag) Source # | |
Defined in Haxl.DataSource.ConcurrentIO data State (ConcurrentIOReq tag) :: * Source # getStateType :: Proxy (ConcurrentIOReq tag) -> TypeRep Source # |
data StateStore Source #
The StateStore
maps a StateKey
to the State
for that type.
Instances
Semigroup StateStore Source # | |
Defined in Haxl.Core.StateStore (<>) :: StateStore -> StateStore -> StateStore # sconcat :: NonEmpty StateStore -> StateStore # stimes :: Integral b => b -> StateStore -> StateStore # | |
Monoid StateStore Source # | |
Defined in Haxl.Core.StateStore mempty :: StateStore # mappend :: StateStore -> StateStore -> StateStore # mconcat :: [StateStore] -> StateStore # |
stateGet :: forall r. StateKey r => StateStore -> Maybe (State r) Source #
Retrieves a State
from the StateStore
container.
stateSet :: forall f. StateKey f => State f -> StateStore -> StateStore Source #
Inserts a State
in the StateStore
container.
stateEmpty :: StateStore Source #
A StateStore
with no entries.