extensible-effects-2.6.3.0: An Alternative to Monad Transformers

Safe HaskellSafe
LanguageHaskell2010

Control.Eff.Fresh

Description

Create unique Enumerable values.

Synopsis

Documentation

data Fresh v where Source #

Create unique Enumerable values.

Constructors

Fresh :: Fresh Int 

Instances

(MonadBase m m, SetMember (* -> *) (Lift *) (Lift * m) r, MonadBaseControl m (Eff r)) => MonadBaseControl m (Eff ((:) (* -> *) Fresh r)) Source # 

Associated Types

type StM (Eff (((* -> *) ': Fresh) r) :: * -> *) a :: * #

Methods

liftBaseWith :: (RunInBase (Eff (((* -> *) ': Fresh) r)) m -> m a) -> Eff (((* -> *) ': Fresh) r) a #

restoreM :: StM (Eff (((* -> *) ': Fresh) r)) a -> Eff (((* -> *) ': Fresh) r) a #

type StM (Eff ((:) (* -> *) Fresh r)) a Source # 
type StM (Eff ((:) (* -> *) Fresh r)) a = StM (Eff r) (a, Int)

fresh :: Member Fresh r => Eff r Int Source #

Produce a value that has not been previously produced.

runFresh' :: Eff (Fresh ': r) w -> Int -> Eff r w Source #

Run an effect requiring unique values.