Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
fresh :: (Member Fresh sig, Carrier sig m) => m Int Source #
Produce a fresh (i.e. unique) Int
.
run (runFresh (replicateM n fresh)) == nub (run (runFresh (replicateM n fresh)))
resetFresh :: (Member Fresh sig, Carrier sig m) => m a -> m a Source #
Reset the fresh counter after running a computation.
run (runFresh (resetFresh (replicateM m fresh) *> replicateM n fresh)) == run (runFresh (replicateM n fresh))
runFresh :: Functor m => FreshC m a -> m a Source #
Run a Fresh
effect counting up from 0.
run (runFresh (replicateM n fresh)) == [0..pred n]
run (runFresh (replicateM n fresh *> pure b)) == b
Instances
MonadTrans FreshC Source # | |
Defined in Control.Effect.Fresh | |
Monad m => Monad (FreshC m) Source # | |
Functor m => Functor (FreshC m) Source # | |
MonadFail m => MonadFail (FreshC m) Source # | |
Defined in Control.Effect.Fresh | |
Monad m => Applicative (FreshC m) Source # | |
MonadIO m => MonadIO (FreshC m) Source # | |
Defined in Control.Effect.Fresh | |
(Alternative m, Monad m) => Alternative (FreshC m) Source # | |
(Alternative m, Monad m) => MonadPlus (FreshC m) Source # | |
(Carrier sig m, Effect sig) => Carrier (Fresh :+: sig) (FreshC m) Source # | |