module Control.Monad.Trans.MSF.Random
( runRandS
, evalRandS
, getRandomS
, getRandomsS
, getRandomRS
, getRandomRS_
, getRandomsRS
, getRandomsRS_
)
where
import Control.Arrow (arr, (>>>))
import Control.Monad.Random (MonadRandom, RandT, Random, RandomGen, getRandom,
getRandomR, getRandomRs, getRandoms, runRandT)
import Control.Monad.Trans.MSF.State (StateT (..), runStateS_)
import Data.MonadicStreamFunction (MSF, arrM, constM, morphS)
runRandS :: (RandomGen g, Functor m, Monad m)
=> MSF (RandT g m) a b
-> g
-> MSF m a (g, b)
runRandS :: forall g (m :: * -> *) a b.
(RandomGen g, Functor m, Monad m) =>
MSF (RandT g m) a b -> g -> MSF m a (g, b)
runRandS = forall (m :: * -> *) s a b.
(Functor m, Monad m) =>
MSF (StateT s m) a b -> s -> MSF m a (s, b)
runStateS_ forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m2 :: * -> *) (m1 :: * -> *) a b.
(Monad m2, Monad m1) =>
(forall c. m1 c -> m2 c) -> MSF m1 a b -> MSF m2 a b
morphS (forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
StateT forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall g (m :: * -> *) a. RandT g m a -> g -> m (a, g)
runRandT)
evalRandS :: (RandomGen g, Functor m, Monad m)
=> MSF (RandT g m) a b -> g -> MSF m a b
evalRandS :: forall g (m :: * -> *) a b.
(RandomGen g, Functor m, Monad m) =>
MSF (RandT g m) a b -> g -> MSF m a b
evalRandS MSF (RandT g m) a b
msf g
g = forall g (m :: * -> *) a b.
(RandomGen g, Functor m, Monad m) =>
MSF (RandT g m) a b -> g -> MSF m a (g, b)
runRandS MSF (RandT g m) a b
msf g
g forall {k} (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr forall a b. (a, b) -> b
snd
getRandomS :: (MonadRandom m, Random b) => MSF m a b
getRandomS :: forall (m :: * -> *) b a. (MonadRandom m, Random b) => MSF m a b
getRandomS = forall (m :: * -> *) b a. Monad m => m b -> MSF m a b
constM forall (m :: * -> *) a. (MonadRandom m, Random a) => m a
getRandom
getRandomsS :: (MonadRandom m, Random b) => MSF m a [b]
getRandomsS :: forall (m :: * -> *) b a. (MonadRandom m, Random b) => MSF m a [b]
getRandomsS = forall (m :: * -> *) b a. Monad m => m b -> MSF m a b
constM forall (m :: * -> *) a. (MonadRandom m, Random a) => m [a]
getRandoms
getRandomRS :: (MonadRandom m, Random b) => (b, b) -> MSF m a b
getRandomRS :: forall (m :: * -> *) b a.
(MonadRandom m, Random b) =>
(b, b) -> MSF m a b
getRandomRS (b, b)
range = forall (m :: * -> *) b a. Monad m => m b -> MSF m a b
constM forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. (MonadRandom m, Random a) => (a, a) -> m a
getRandomR (b, b)
range
getRandomRS_ :: (MonadRandom m, Random b) => MSF m (b, b) b
getRandomRS_ :: forall (m :: * -> *) b. (MonadRandom m, Random b) => MSF m (b, b) b
getRandomRS_ = forall (m :: * -> *) a b. Monad m => (a -> m b) -> MSF m a b
arrM forall (m :: * -> *) a. (MonadRandom m, Random a) => (a, a) -> m a
getRandomR
getRandomsRS :: (MonadRandom m, Random b) => (b, b) -> MSF m a [b]
getRandomsRS :: forall (m :: * -> *) b a.
(MonadRandom m, Random b) =>
(b, b) -> MSF m a [b]
getRandomsRS (b, b)
range = forall (m :: * -> *) b a. Monad m => m b -> MSF m a b
constM forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
(MonadRandom m, Random a) =>
(a, a) -> m [a]
getRandomRs (b, b)
range
getRandomsRS_ :: (MonadRandom m, Random b) => MSF m (b, b) [b]
getRandomsRS_ :: forall (m :: * -> *) b.
(MonadRandom m, Random b) =>
MSF m (b, b) [b]
getRandomsRS_ = forall (m :: * -> *) a b. Monad m => (a -> m b) -> MSF m a b
arrM forall (m :: * -> *) a.
(MonadRandom m, Random a) =>
(a, a) -> m [a]
getRandomRs