-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Experimental, RandomFu effect and interpreters for polysemy -- -- Please see the README on GitHub at -- https://github.com/adamConnerSax/polysemy-Extra/tree/master/polysemy-RandomFu#polysemy-randomfu @package polysemy-RandomFu @version 0.4.0.0 -- | Polysemy "random-fu" effect. This can be run in a few ways: 1. -- Directly in IO 2. Using any RandomSource from -- "random-fu" 3. In IO, using a given PureMT source. -- (IO is used to put the source in an IORef) -- -- This module also contains the type-class instances to enable -- "absorbing" MonadRandom, ala Polysemy.MTL. See the tests for MTL or -- RandomFu for examples of that in use. module Polysemy.RandomFu -- | An effect capable of sampling from a "random-fu" RVar or generating a -- single random-variate of any type, t with a -- Data.Random.Prim t constructor, currently one of -- Word8, Word16, Word32, Word64, -- Double or N-byte integer. data RandomFu m r [SampleRVar] :: RVar t -> RandomFu m t [GetRandomPrim] :: Prim t -> RandomFu m t sampleRVar :: forall r_aiVe t_agad. MemberWithError RandomFu r_aiVe => RVar t_agad -> Sem r_aiVe t_agad getRandomPrim :: forall r_aiVg t_agcc. MemberWithError RandomFu r_aiVg => Prim t_agcc -> Sem r_aiVg t_agcc -- | use the RandomFu effect to sample from a "random-fu" -- Distribution. sampleDist :: (Member RandomFu r, Distribution d t) => d t -> Sem r t -- | Run a Random effect using a given RandomSource runRandomSource :: forall s m r a. (RandomSource m s, Member (Embed m) r) => s -> Sem (RandomFu : r) a -> Sem r a -- | Run a Random effect by using the default "random-fu" -- IO source runRandomIO :: forall r a. MonadIO (Sem r) => Sem (RandomFu : r) a -> Sem r a -- | Run in IO, using the given PureMT source, stored in an -- IORef runRandomIOPureMT :: Member (Embed IO) r => PureMT -> Sem (RandomFu : r) a -> Sem r a module Polysemy.ConstraintAbsorber.MonadRandom -- | absorb a MonadError e constraint into Member (Error e) r -- => Sem r absorbMonadRandom :: Member RandomFu r => (MonadRandom (Sem r) => Sem r a) -> Sem r a instance forall k (m :: * -> *) (s' :: k). (GHC.Base.Monad m, Data.Reflection.Reifies s' (Polysemy.ConstraintAbsorber.MonadRandom.RandomDict m)) => Data.Random.Internal.Source.MonadRandom (Polysemy.ConstraintAbsorber.MonadRandom.Action m s') instance forall (m :: * -> *) k (s' :: k). GHC.Base.Monad m => GHC.Base.Monad (Polysemy.ConstraintAbsorber.MonadRandom.Action m s') instance forall (m :: * -> *) k (s' :: k). GHC.Base.Applicative m => GHC.Base.Applicative (Polysemy.ConstraintAbsorber.MonadRandom.Action m s') instance forall (m :: * -> *) k (s' :: k). GHC.Base.Functor m => GHC.Base.Functor (Polysemy.ConstraintAbsorber.MonadRandom.Action m s')