{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
module FRP.Rhine.ClSF.Random (
module FRP.Rhine.ClSF.Random,
module X,
)
where
import Control.Monad.IO.Class
import Control.Monad.Random
import Control.Monad.Trans.MSF.Except (performOnFirstSample)
import Control.Monad.Trans.MSF.Random as X hiding (evalRandS, getRandomRS, getRandomRS_, getRandomS, runRandS)
import qualified Control.Monad.Trans.MSF.Random as MSF
import FRP.Rhine.ClSF.Core
import FRP.Rhine.ClSF.Random.Util
runRandS ::
(RandomGen g, Monad m) =>
ClSF (RandT g m) cl a b ->
g ->
ClSF m cl a (g, b)
runRandS :: forall g (m :: Type -> Type) cl a b.
(RandomGen g, Monad m) =>
ClSF (RandT g m) cl a b -> g -> ClSF m cl a (g, b)
runRandS ClSF (RandT g m) cl a b
clsf = forall g (m :: Type -> Type) a b.
(RandomGen g, Functor m, Monad m) =>
MSF (RandT g m) a b -> g -> MSF m a (g, b)
MSF.runRandS (forall (m2 :: Type -> Type) (m1 :: Type -> Type) a b.
(Monad m2, Monad m1) =>
(forall c. m1 c -> m2 c) -> MSF m1 a b -> MSF m2 a b
morphS forall r g (m :: Type -> Type) a.
ReaderT r (RandT g m) a -> RandT g (ReaderT r m) a
commuteReaderRand ClSF (RandT g m) cl a b
clsf)
evalRandS ::
(RandomGen g, Monad m) =>
ClSF (RandT g m) cl a b ->
g ->
ClSF m cl a b
evalRandS :: forall g (m :: Type -> Type) cl a b.
(RandomGen g, Monad m) =>
ClSF (RandT g m) cl a b -> g -> ClSF m cl a b
evalRandS ClSF (RandT g m) cl a b
clsf g
g = forall g (m :: Type -> Type) cl a b.
(RandomGen g, Monad m) =>
ClSF (RandT g m) cl a b -> g -> ClSF m cl a (g, b)
runRandS ClSF (RandT g m) cl a b
clsf g
g forall {k} (cat :: k -> k -> Type) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> forall (a :: Type -> Type -> Type) b c.
Arrow a =>
(b -> c) -> a b c
arr forall a b. (a, b) -> b
snd
execRandS ::
(RandomGen g, Monad m) =>
ClSF (RandT g m) cl a b ->
g ->
ClSF m cl a g
execRandS :: forall g (m :: Type -> Type) cl a b.
(RandomGen g, Monad m) =>
ClSF (RandT g m) cl a b -> g -> ClSF m cl a g
execRandS ClSF (RandT g m) cl a b
clsf g
g = forall g (m :: Type -> Type) cl a b.
(RandomGen g, Monad m) =>
ClSF (RandT g m) cl a b -> g -> ClSF m cl a (g, b)
runRandS ClSF (RandT g m) cl a b
clsf g
g forall {k} (cat :: k -> k -> Type) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> forall (a :: Type -> Type -> Type) b c.
Arrow a =>
(b -> c) -> a b c
arr forall a b. (a, b) -> a
fst
evalRandIOS ::
Monad m =>
ClSF (RandT StdGen m) cl a b ->
IO (ClSF m cl a b)
evalRandIOS :: forall (m :: Type -> Type) cl a b.
Monad m =>
ClSF (RandT StdGen m) cl a b -> IO (ClSF m cl a b)
evalRandIOS ClSF (RandT StdGen m) cl a b
clsf = forall g (m :: Type -> Type) cl a b.
(RandomGen g, Monad m) =>
ClSF (RandT g m) cl a b -> g -> ClSF m cl a b
evalRandS ClSF (RandT StdGen m) cl a b
clsf forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: Type -> Type). MonadIO m => m StdGen
newStdGen
evalRandIOS' ::
MonadIO m =>
ClSF (RandT StdGen m) cl a b ->
ClSF m cl a b
evalRandIOS' :: forall (m :: Type -> Type) cl a b.
MonadIO m =>
ClSF (RandT StdGen m) cl a b -> ClSF m cl a b
evalRandIOS' = forall (m :: Type -> Type) a b.
Monad m =>
m (MSF m a b) -> MSF m a b
performOnFirstSample forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: Type -> Type) cl a b.
Monad m =>
ClSF (RandT StdGen m) cl a b -> IO (ClSF m cl a b)
evalRandIOS
getRandomS ::
(MonadRandom m, Random a) =>
Behaviour m time a
getRandomS :: forall (m :: Type -> Type) a time.
(MonadRandom m, Random a) =>
Behaviour m time a
getRandomS = forall (m :: Type -> Type) b cl a. Monad m => m b -> ClSF m cl a b
constMCl forall (m :: Type -> Type) a. (MonadRandom m, Random a) => m a
getRandom
getRandomRS ::
(MonadRandom m, Random a) =>
BehaviourF m time (a, a) a
getRandomRS :: forall (m :: Type -> Type) a time.
(MonadRandom m, Random a) =>
BehaviourF m time (a, a) a
getRandomRS = forall (m :: Type -> Type) a b cl.
Monad m =>
(a -> m b) -> ClSF m cl a b
arrMCl forall (m :: Type -> Type) a.
(MonadRandom m, Random a) =>
(a, a) -> m a
getRandomR
getRandomRS_ ::
(MonadRandom m, Random a) =>
(a, a) ->
Behaviour m time a
getRandomRS_ :: forall (m :: Type -> Type) a time.
(MonadRandom m, Random a) =>
(a, a) -> Behaviour m time a
getRandomRS_ (a, a)
range = forall (m :: Type -> Type) b cl a. Monad m => m b -> ClSF m cl a b
constMCl forall a b. (a -> b) -> a -> b
$ forall (m :: Type -> Type) a.
(MonadRandom m, Random a) =>
(a, a) -> m a
getRandomR (a, a)
range