fused-effects-1.0.2.0: A fast, flexible, fused effect system.
Safe HaskellNone
LanguageHaskell2010

Control.Carrier.Fresh.Strict

Description

A carrier for a Fresh effect, providing access to a monotonically increasing stream of Int values.

Since: 1.0.0.0

Synopsis

Fresh carrier

runFresh :: Int -> FreshC m a -> m (Int, a) Source #

Run a Fresh effect counting up from 0.

runFresh n (pure a) = pure (n, a)
runFresh n fresh = pure (n + 1, n)

Since: 0.1.0.0

evalFresh :: Functor m => Int -> FreshC m a -> m a Source #

Run a Fresh effect counting up from an initial value, and forgetting the final value.

evalFresh n (pure a) = pure a
evalFresh n fresh = pure n

Since: 1.0.0.0

newtype FreshC m a Source #

Since: 1.0.0.0

Constructors

FreshC (StateC Int m a) 

Instances

Instances details
MonadTrans FreshC Source # 
Instance details

Defined in Control.Carrier.Fresh.Strict

Methods

lift :: Monad m => m a -> FreshC m a #

Monad m => Monad (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Strict

Methods

(>>=) :: FreshC m a -> (a -> FreshC m b) -> FreshC m b #

(>>) :: FreshC m a -> FreshC m b -> FreshC m b #

return :: a -> FreshC m a #

Functor m => Functor (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Strict

Methods

fmap :: (a -> b) -> FreshC m a -> FreshC m b #

(<$) :: a -> FreshC m b -> FreshC m a #

MonadFix m => MonadFix (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Strict

Methods

mfix :: (a -> FreshC m a) -> FreshC m a #

MonadFail m => MonadFail (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Strict

Methods

fail :: String -> FreshC m a #

Monad m => Applicative (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Strict

Methods

pure :: a -> FreshC m a #

(<*>) :: FreshC m (a -> b) -> FreshC m a -> FreshC m b #

liftA2 :: (a -> b -> c) -> FreshC m a -> FreshC m b -> FreshC m c #

(*>) :: FreshC m a -> FreshC m b -> FreshC m b #

(<*) :: FreshC m a -> FreshC m b -> FreshC m a #

MonadIO m => MonadIO (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Strict

Methods

liftIO :: IO a -> FreshC m a #

(Alternative m, Monad m) => Alternative (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Strict

Methods

empty :: FreshC m a #

(<|>) :: FreshC m a -> FreshC m a -> FreshC m a #

some :: FreshC m a -> FreshC m [a] #

many :: FreshC m a -> FreshC m [a] #

(Alternative m, Monad m) => MonadPlus (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Strict

Methods

mzero :: FreshC m a #

mplus :: FreshC m a -> FreshC m a -> FreshC m a #

(Algebra sig m, Effect sig) => Algebra (Fresh :+: sig) (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Strict

Methods

alg :: (Fresh :+: sig) (FreshC m) a -> FreshC m a Source #

Fresh effect