cleff-0.3.2.0: Fast and concise extensible effects
Copyright(c) 2021 Xy Ren
LicenseBSD3
Maintainerxy.r@outlook.com
Stabilityexperimental
Portabilitynon-portable (GHC only)
Safe HaskellTrustworthy
LanguageHaskell2010

Cleff.Fresh

Description

 
Synopsis

Effect

data Fresh u :: Effect where Source #

An effect capable of generating unique values. This effect can be useful in generating variable indices.

Constructors

Fresh :: Fresh u m u 

Operations

fresh :: Fresh u :> es => Eff es u Source #

Obtain a fresh unique value.

Interpretations

freshIntToState :: Eff (Fresh Int ': es) ~> Eff (State Int ': es) Source #

Interpret a Fresh Int effect in terms of State Int. This is a specialized version of freshEnumToState.

freshEnumToState :: Enum a => Eff (Fresh a ': es) ~> Eff (State a ': es) Source #

Interpret a Fresh a in terms of State a for any Enum. Every time succ is called to generate the next value.

Since: 0.2.1.0

runFreshAtomicCounter :: Eff (Fresh Int ': es) ~> Eff es Source #

Interpret a Fresh Int effect in terms of a AtomicCounter. This is usually faster than runFreshUnique.

Since: 0.2.1.0

runFreshUnique :: IOE :> es => Eff (Fresh Unique ': es) ~> Eff es Source #

Interpret a Fresh Unique effect in terms of IO actions. This is slower than runFreshAtomicCounter, but it won't overflow on maxBound :: Int.