extensible-effects-5.0.0.1: An Alternative to Monad Transformers
Control.Eff.Fresh
Description
Create unique Enumerable values.
data Fresh v where Source #
Constructors
Given a continuation and requests, respond to them
Defined in Control.Eff.Fresh
Methods
handle :: (Eff r a -> Int -> k) -> Arrs r v a -> Fresh v -> Int -> k Source #
handle_relay :: (r ~ (Fresh ': r'), Relay (Int -> k) r') => (a -> Int -> k) -> (Eff r a -> Int -> k) -> Eff r a -> Int -> k Source #
respond_relay :: (a -> Int -> k) -> (Eff r a -> Int -> k) -> Eff r a -> Int -> k Source #
Associated Types
type StM (Eff (Fresh ': r)) a :: Type #
liftBaseWith :: (RunInBase (Eff (Fresh ': r)) m -> m a) -> Eff (Fresh ': r) a #
restoreM :: StM (Eff (Fresh ': r)) a -> Eff (Fresh ': r) a #
withFresh :: Monad m => a -> Int -> m (a, Int) Source #
Embed a pure value. Note that this is a specialized form of State's and we could have reused it.
fresh :: Member Fresh r => Eff r Int Source #
Produce a value that has not been previously produced.
runFresh' :: Int -> Eff (Fresh ': r) w -> Eff r w Source #
Run an effect requiring unique values.