Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype RandomC prim m a = RandomC {
- runRandomC :: ReaderC (Gen (PrimState prim)) m a
- runRandomSystem :: MonadIO m => RandomC IO m a -> m a
- runRandomSeeded :: forall m n sig a. (Has (Lift n) sig m, PrimMonad n) => Seed -> RandomC n m a -> m a
- module Control.Effect.Random
Documentation
newtype RandomC prim m a Source #
RandomC | |
|
Instances
Monad m => Monad (RandomC prim m) Source # | |
Functor m => Functor (RandomC prim m) Source # | |
MonadFail m => MonadFail (RandomC prim m) Source # | |
Defined in Control.Carrier.Random.Lifted | |
Applicative m => Applicative (RandomC prim m) Source # | |
Defined in Control.Carrier.Random.Lifted pure :: a -> RandomC prim m a # (<*>) :: RandomC prim m (a -> b) -> RandomC prim m a -> RandomC prim m b # liftA2 :: (a -> b -> c) -> RandomC prim m a -> RandomC prim m b -> RandomC prim m c # (*>) :: RandomC prim m a -> RandomC prim m b -> RandomC prim m b # (<*) :: RandomC prim m a -> RandomC prim m b -> RandomC prim m a # | |
MonadIO m => MonadIO (RandomC prim m) Source # | |
Defined in Control.Carrier.Random.Lifted | |
(Algebra sig m, Member (Lift n) sig, PrimMonad n) => Algebra (Random :+: sig) (RandomC n m) Source # | |
runRandomSystem :: MonadIO m => RandomC IO m a -> m a Source #
Run a computation, seeding its random values from the system random number generator.
This is the de facto standard way to use this carrier. Keep in mind that seeding the RNG may be a computationally intensive process.
runRandomSeeded :: forall m n sig a. (Has (Lift n) sig m, PrimMonad n) => Seed -> RandomC n m a -> m a Source #
Run a computation, seeding its random values from an existing Seed
.
Random effect
module Control.Effect.Random