Copyright | (c) 2021 Xy Ren |
---|---|
License | BSD3 |
Maintainer | xy.r@outlook.com |
Stability | experimental |
Portability | non-portable (GHC only) |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Synopsis
- data Fresh u :: Effect where
- fresh :: Fresh u :> es => Eff es u
- freshIntToState :: Eff (Fresh Int ': es) ~> Eff (State Int ': es)
- freshEnumToState :: Enum a => Eff (Fresh a ': es) ~> Eff (State a ': es)
- runFreshAtomicCounter :: Eff (Fresh Int ': es) ~> Eff es
- runFreshUnique :: IOE :> es => Eff (Fresh Unique ': es) ~> Eff es
Effect
data Fresh u :: Effect where Source #
An effect capable of generating unique values. This effect can be useful in generating variable indices.
Operations
Interpretations
freshIntToState :: Eff (Fresh Int ': es) ~> Eff (State Int ': es) Source #
Interpret a
effect in terms of Fresh
Int
. This is a specialized version of
State
Int
freshEnumToState
.
runFreshAtomicCounter :: Eff (Fresh Int ': es) ~> Eff es Source #
Interpret a
effect in terms of a Fresh
Int
AtomicCounter
. This is usually faster
than runFreshUnique
.
Since: 0.2.1.0