fused-effects-random-1.1.0.1: Random number generation for fused-effects.
Safe HaskellNone
LanguageHaskell2010

Control.Carrier.Random.Gen

Description

A carrier for Control.Effect.Random.Random implemented using RandomGen.

Since: 1.1

Synopsis

Random carrier

runRandom :: Applicative m => g -> RandomC g m a -> m (g, a) Source #

Run a random computation starting from a given generator.

runRandom g (pure b) = pure (g, b)

Since: 1.0

evalRandom :: Applicative m => g -> RandomC g m a -> m a Source #

Run a random computation starting from a given generator and discarding the final generator.

evalRandom g (pure b) = pure b

Since: 1.0

execRandom :: Applicative m => g -> RandomC g m a -> m g Source #

Run a random computation starting from a given generator and discarding the final result.

execRandom g (pure b) = g

Since: 1.0

evalRandomSystem :: MonadIO m => RandomC StdGen m a -> m a Source #

Run a random computation in IO, splitting the global standard generator to get a new one for the computation.

Since: 1.1

newtype RandomC g (m :: Type -> Type) a Source #

A carrier for Random implemented using RandomGen.

Since: 1.0

Constructors

RandomC (StateC g m a) 

Instances

Instances details
MonadTrans (RandomC g) Source # 
Instance details

Defined in Control.Carrier.Random.Gen

Methods

lift :: Monad m => m a -> RandomC g m a #

MonadIO m => MonadIO (RandomC g m) Source # 
Instance details

Defined in Control.Carrier.Random.Gen

Methods

liftIO :: IO a -> RandomC g m a #

Alternative m => Alternative (RandomC g m) Source # 
Instance details

Defined in Control.Carrier.Random.Gen

Methods

empty :: RandomC g m a #

(<|>) :: RandomC g m a -> RandomC g m a -> RandomC g m a #

some :: RandomC g m a -> RandomC g m [a] #

many :: RandomC g m a -> RandomC g m [a] #

Applicative (RandomC g m) Source # 
Instance details

Defined in Control.Carrier.Random.Gen

Methods

pure :: a -> RandomC g m a #

(<*>) :: RandomC g m (a -> b) -> RandomC g m a -> RandomC g m b #

liftA2 :: (a -> b -> c) -> RandomC g m a -> RandomC g m b -> RandomC g m c #

(*>) :: RandomC g m a -> RandomC g m b -> RandomC g m b #

(<*) :: RandomC g m a -> RandomC g m b -> RandomC g m a #

Functor (RandomC g m) Source # 
Instance details

Defined in Control.Carrier.Random.Gen

Methods

fmap :: (a -> b) -> RandomC g m a -> RandomC g m b #

(<$) :: a -> RandomC g m b -> RandomC g m a #

Monad (RandomC g m) Source # 
Instance details

Defined in Control.Carrier.Random.Gen

Methods

(>>=) :: RandomC g m a -> (a -> RandomC g m b) -> RandomC g m b #

(>>) :: RandomC g m a -> RandomC g m b -> RandomC g m b #

return :: a -> RandomC g m a #

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

Defined in Control.Carrier.Random.Gen

Methods

mzero :: RandomC g m a #

mplus :: RandomC g m a -> RandomC g m a -> RandomC g m a #

MonadFail m => MonadFail (RandomC g m) Source # 
Instance details

Defined in Control.Carrier.Random.Gen

Methods

fail :: String -> RandomC g m a #

MonadFix m => MonadFix (RandomC g m) Source # 
Instance details

Defined in Control.Carrier.Random.Gen

Methods

mfix :: (a -> RandomC g m a) -> RandomC g m a #

(Algebra sig m, RandomGen g) => Algebra (Random :+: sig) (RandomC g m) Source # 
Instance details

Defined in Control.Carrier.Random.Gen

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (RandomC g m) -> (Random :+: sig) n a -> ctx () -> RandomC g m (ctx a) #

Random effect