-- |
-- Module     : Simulation.Aivika.Operation.Random
-- Copyright  : Copyright (c) 2009-2017, David Sorokin <david.sorokin@gmail.com>
-- License    : BSD3
-- Maintainer : David Sorokin <david.sorokin@gmail.com>
-- Stability  : experimental
-- Tested with: GHC 8.0.1
--
-- This module defines some useful predefined operations that
-- hold the current process for the corresponding random time
-- interval, when processing every input element.
--

module Simulation.Aivika.Operation.Random
       (newRandomUniformOperation,
        newRandomUniformIntOperation,
        newRandomTriangularOperation,
        newRandomNormalOperation,
        newRandomLogNormalOperation,
        newRandomExponentialOperation,
        newRandomErlangOperation,
        newRandomPoissonOperation,
        newRandomBinomialOperation,
        newRandomGammaOperation,
        newRandomBetaOperation,
        newRandomWeibullOperation,
        newRandomDiscreteOperation,
        newPreemptibleRandomUniformOperation,
        newPreemptibleRandomUniformIntOperation,
        newPreemptibleRandomTriangularOperation,
        newPreemptibleRandomNormalOperation,
        newPreemptibleRandomLogNormalOperation,
        newPreemptibleRandomExponentialOperation,
        newPreemptibleRandomErlangOperation,
        newPreemptibleRandomPoissonOperation,
        newPreemptibleRandomBinomialOperation,
        newPreemptibleRandomGammaOperation,
        newPreemptibleRandomBetaOperation,
        newPreemptibleRandomWeibullOperation,
        newPreemptibleRandomDiscreteOperation) where

import Simulation.Aivika.Generator
import Simulation.Aivika.Event
import Simulation.Aivika.Process
import Simulation.Aivika.Process.Random
import Simulation.Aivika.Operation

-- | Create a new operation that holds the process for a random time interval
-- distributed uniformly, when processing every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomUniformOperation :: Double
                             -- ^ the minimum time interval
                             -> Double
                             -- ^ the maximum time interval
                             -> Event (Operation a a)
newRandomUniformOperation :: forall a. Double -> Double -> Event (Operation a a)
newRandomUniformOperation =
  Bool -> Double -> Double -> Event (Operation a a)
forall a. Bool -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomUniformOperation Bool
False

-- | Create a new operation that holds the process for a random time interval
-- distributed uniformly, when processing every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomUniformIntOperation :: Int
                                -- ^ the minimum time interval
                                -> Int
                                -- ^ the maximum time interval
                                -> Event (Operation a a)
newRandomUniformIntOperation :: forall a. Int -> Int -> Event (Operation a a)
newRandomUniformIntOperation =
  Bool -> Int -> Int -> Event (Operation a a)
forall a. Bool -> Int -> Int -> Event (Operation a a)
newPreemptibleRandomUniformIntOperation Bool
False

-- | Create a new operation that holds the process for a random time interval
-- having the triangular distribution, when processing every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomTriangularOperation :: Double
                                -- ^ the minimum time interval
                                -> Double
                                -- ^ the median of the time interval
                                -> Double
                                -- ^ the maximum time interval
                                -> Event (Operation a a)
newRandomTriangularOperation :: forall a. Double -> Double -> Double -> Event (Operation a a)
newRandomTriangularOperation =
  Bool -> Double -> Double -> Double -> Event (Operation a a)
forall a.
Bool -> Double -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomTriangularOperation Bool
False

-- | Create a new operation that holds the process for a random time interval
-- distributed normally, when processing every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomNormalOperation :: Double
                            -- ^ the mean time interval
                            -> Double
                            -- ^ the time interval deviation
                            -> Event (Operation a a)
newRandomNormalOperation :: forall a. Double -> Double -> Event (Operation a a)
newRandomNormalOperation =
  Bool -> Double -> Double -> Event (Operation a a)
forall a. Bool -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomNormalOperation Bool
False
         
-- | Create a new operation that holds the process for a random time interval
-- having the lognormal distribution, when processing every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomLogNormalOperation :: Double
                               -- ^ the mean of a normal distribution which
                               -- this distribution is derived from
                               -> Double
                               -- ^ the deviation of a normal distribution which
                               -- this distribution is derived from
                               -> Event (Operation a a)
newRandomLogNormalOperation :: forall a. Double -> Double -> Event (Operation a a)
newRandomLogNormalOperation =
  Bool -> Double -> Double -> Event (Operation a a)
forall a. Bool -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomLogNormalOperation Bool
False

-- | Create a new operation that holds the process for a random time interval
-- distributed exponentially with the specified mean (the reciprocal of the rate),
-- when processing every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomExponentialOperation :: Double
                                 -- ^ the mean time interval (the reciprocal of the rate)
                                 -> Event (Operation a a)
newRandomExponentialOperation :: forall a. Double -> Event (Operation a a)
newRandomExponentialOperation =
  Bool -> Double -> Event (Operation a a)
forall a. Bool -> Double -> Event (Operation a a)
newPreemptibleRandomExponentialOperation Bool
False
         
-- | Create a new operation that holds the process for a random time interval
-- having the Erlang distribution with the specified scale (the reciprocal of the rate)
-- and shape parameters, when processing every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomErlangOperation :: Double
                            -- ^ the scale (the reciprocal of the rate)
                            -> Int
                            -- ^ the shape
                            -> Event (Operation a a)
newRandomErlangOperation :: forall a. Double -> Int -> Event (Operation a a)
newRandomErlangOperation =
  Bool -> Double -> Int -> Event (Operation a a)
forall a. Bool -> Double -> Int -> Event (Operation a a)
newPreemptibleRandomErlangOperation Bool
False

-- | Create a new operation that holds the process for a random time interval
-- having the Poisson distribution with the specified mean, when processing
-- every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomPoissonOperation :: Double
                             -- ^ the mean time interval
                             -> Event (Operation a a)
newRandomPoissonOperation :: forall a. Double -> Event (Operation a a)
newRandomPoissonOperation =
  Bool -> Double -> Event (Operation a a)
forall a. Bool -> Double -> Event (Operation a a)
newPreemptibleRandomPoissonOperation Bool
False

-- | Create a new operation that holds the process for a random time interval
-- having the binomial distribution with the specified probability and trials,
-- when processing every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomBinomialOperation :: Double
                              -- ^ the probability
                              -> Int
                              -- ^ the number of trials
                              -> Event (Operation a a)
newRandomBinomialOperation :: forall a. Double -> Int -> Event (Operation a a)
newRandomBinomialOperation =
  Bool -> Double -> Int -> Event (Operation a a)
forall a. Bool -> Double -> Int -> Event (Operation a a)
newPreemptibleRandomBinomialOperation Bool
False

-- | Create a new operation that holds the process for a random time interval
-- having the Gamma distribution with the specified shape and scale,
-- when processing every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomGammaOperation :: Double
                           -- ^ the shape
                           -> Double
                           -- ^ the scale (a reciprocal of the rate)
                           -> Event (Operation a a)
newRandomGammaOperation :: forall a. Double -> Double -> Event (Operation a a)
newRandomGammaOperation =
  Bool -> Double -> Double -> Event (Operation a a)
forall a. Bool -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomGammaOperation Bool
False

-- | Create a new operation that holds the process for a random time interval
-- having the Beta distribution with the specified shape parameters (alpha and beta),
-- when processing every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomBetaOperation :: Double
                          -- ^ shape (alpha)
                          -> Double
                          -- ^ shape (beta)
                          -> Event (Operation a a)
newRandomBetaOperation :: forall a. Double -> Double -> Event (Operation a a)
newRandomBetaOperation =
  Bool -> Double -> Double -> Event (Operation a a)
forall a. Bool -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomBetaOperation Bool
False

-- | Create a new operation that holds the process for a random time interval
-- having the Weibull distribution with the specified shape and scale,
-- when processing every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomWeibullOperation :: Double
                             -- ^ shape
                             -> Double
                             -- ^ scale
                             -> Event (Operation a a)
newRandomWeibullOperation :: forall a. Double -> Double -> Event (Operation a a)
newRandomWeibullOperation =
  Bool -> Double -> Double -> Event (Operation a a)
forall a. Bool -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomWeibullOperation Bool
False

-- | Create a new operation that holds the process for a random time interval
-- having the specified discrete distribution, when processing every input element.
--
-- By default, it is assumed that the operation process cannot be preempted,
-- because the handling of possible task preemption is rather costly.
newRandomDiscreteOperation :: DiscretePDF Double
                              -- ^ the discrete probability density function
                              -> Event (Operation a a)
newRandomDiscreteOperation :: forall a. DiscretePDF Double -> Event (Operation a a)
newRandomDiscreteOperation =
  Bool -> DiscretePDF Double -> Event (Operation a a)
forall a. Bool -> DiscretePDF Double -> Event (Operation a a)
newPreemptibleRandomDiscreteOperation Bool
False

-- | Create a new operation that holds the process for a random time interval
-- distributed uniformly, when processing every input element.
newPreemptibleRandomUniformOperation :: Bool
                                        -- ^ whether the operation process can be preempted
                                        -> Double
                                        -- ^ the minimum time interval
                                        -> Double
                                        -- ^ the maximum time interval
                                        -> Event (Operation a a)
newPreemptibleRandomUniformOperation :: forall a. Bool -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomUniformOperation Bool
preemptible Double
min Double
max =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do Double -> Double -> Process ()
randomUniformProcess_ Double
min Double
max
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a

-- | Create a new operation that holds the process for a random time interval
-- distributed uniformly, when processing every input element.
newPreemptibleRandomUniformIntOperation :: Bool
                                           -- ^ whether the operation process can be preempted
                                           -> Int
                                           -- ^ the minimum time interval
                                           -> Int
                                           -- ^ the maximum time interval
                                           -> Event (Operation a a)
newPreemptibleRandomUniformIntOperation :: forall a. Bool -> Int -> Int -> Event (Operation a a)
newPreemptibleRandomUniformIntOperation Bool
preemptible Int
min Int
max =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do Int -> Int -> Process ()
randomUniformIntProcess_ Int
min Int
max
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a

-- | Create a new operation that holds the process for a random time interval
-- having the triangular distribution, when processing every input element.
newPreemptibleRandomTriangularOperation :: Bool
                                           -- ^ whether the operation process can be preempted
                                           -> Double
                                           -- ^ the minimum time interval
                                           -> Double
                                           -- ^ the median of the time interval
                                           -> Double
                                           -- ^ the maximum time interval
                                           -> Event (Operation a a)
newPreemptibleRandomTriangularOperation :: forall a.
Bool -> Double -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomTriangularOperation Bool
preemptible Double
min Double
median Double
max =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do Double -> Double -> Double -> Process ()
randomTriangularProcess_ Double
min Double
median Double
max
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a

-- | Create a new operation that holds the process for a random time interval
-- distributed normally, when processing every input element.
newPreemptibleRandomNormalOperation :: Bool
                                       -- ^ whether the operation process can be preempted
                                       -> Double
                                       -- ^ the mean time interval
                                       -> Double
                                       -- ^ the time interval deviation
                                       -> Event (Operation a a)
newPreemptibleRandomNormalOperation :: forall a. Bool -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomNormalOperation Bool
preemptible Double
mu Double
nu =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do Double -> Double -> Process ()
randomNormalProcess_ Double
mu Double
nu
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a

-- | Create a new operation that holds the process for a random time interval
-- having the lognormal distribution, when processing every input element.
newPreemptibleRandomLogNormalOperation :: Bool
                                          -- ^ whether the operation process can be preempted
                                          -> Double
                                          -- ^ the mean of a normal distribution which
                                          -- this distribution is derived from
                                          -> Double
                                          -- ^ the deviation of a normal distribution which
                                          -- this distribution is derived from
                                          -> Event (Operation a a)
newPreemptibleRandomLogNormalOperation :: forall a. Bool -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomLogNormalOperation Bool
preemptible Double
mu Double
nu =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do Double -> Double -> Process ()
randomLogNormalProcess_ Double
mu Double
nu
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a

-- | Create a new operation that holds the process for a random time interval
-- distributed exponentially with the specified mean (the reciprocal of the rate),
-- when processing every input element.
newPreemptibleRandomExponentialOperation :: Bool
                                            -- ^ whether the operation process can be preempted
                                            -> Double
                                            -- ^ the mean time interval (the reciprocal of the rate)
                                            -> Event (Operation a a)
newPreemptibleRandomExponentialOperation :: forall a. Bool -> Double -> Event (Operation a a)
newPreemptibleRandomExponentialOperation Bool
preemptible Double
mu =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do Double -> Process ()
randomExponentialProcess_ Double
mu
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a
         
-- | Create a new operation that holds the process for a random time interval
-- having the Erlang distribution with the specified scale (the reciprocal of the rate)
-- and shape parameters, when processing every input element.
newPreemptibleRandomErlangOperation :: Bool
                                       -- ^ whether the operation process can be preempted
                                       -> Double
                                       -- ^ the scale (the reciprocal of the rate)
                                       -> Int
                                       -- ^ the shape
                                       -> Event (Operation a a)
newPreemptibleRandomErlangOperation :: forall a. Bool -> Double -> Int -> Event (Operation a a)
newPreemptibleRandomErlangOperation Bool
preemptible Double
beta Int
m =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do Double -> Int -> Process ()
randomErlangProcess_ Double
beta Int
m
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a

-- | Create a new operation that holds the process for a random time interval
-- having the Poisson distribution with the specified mean, when processing
-- every input element.
newPreemptibleRandomPoissonOperation :: Bool
                                        -- ^ whether the operation process can be preempted
                                        -> Double
                                        -- ^ the mean time interval
                                        -> Event (Operation a a)
newPreemptibleRandomPoissonOperation :: forall a. Bool -> Double -> Event (Operation a a)
newPreemptibleRandomPoissonOperation Bool
preemptible Double
mu =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do Double -> Process ()
randomPoissonProcess_ Double
mu
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a

-- | Create a new operation that holds the process for a random time interval
-- having the binomial distribution with the specified probability and trials,
-- when processing every input element.
newPreemptibleRandomBinomialOperation :: Bool
                                         -- ^ whether the operation process can be preempted
                                         -> Double
                                         -- ^ the probability
                                         -> Int
                                         -- ^ the number of trials
                                         -> Event (Operation a a)
newPreemptibleRandomBinomialOperation :: forall a. Bool -> Double -> Int -> Event (Operation a a)
newPreemptibleRandomBinomialOperation Bool
preemptible Double
prob Int
trials =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do Double -> Int -> Process ()
randomBinomialProcess_ Double
prob Int
trials
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a

-- | Create a new operation that holds the process for a random time interval
-- having the Gamma distribution with the specified shape and scale,
-- when processing every input element.
newPreemptibleRandomGammaOperation :: Bool
                                      -- ^ whether the operation process can be preempted
                                      -> Double
                                      -- ^ the shape
                                      -> Double
                                      -- ^ the scale
                                      -> Event (Operation a a)
newPreemptibleRandomGammaOperation :: forall a. Bool -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomGammaOperation Bool
preemptible Double
kappa Double
theta =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do Double -> Double -> Process ()
randomGammaProcess_ Double
kappa Double
theta
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a

-- | Create a new operation that holds the process for a random time interval
-- having the Beta distribution with the specified shape parameters (alpha and beta),
-- when processing every input element.
newPreemptibleRandomBetaOperation :: Bool
                                     -- ^ whether the operation process can be preempted
                                     -> Double
                                     -- ^ shape (alpha)
                                     -> Double
                                     -- ^ shape (beta)
                                     -> Event (Operation a a)
newPreemptibleRandomBetaOperation :: forall a. Bool -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomBetaOperation Bool
preemptible Double
alpha Double
beta =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do Double -> Double -> Process ()
randomBetaProcess_ Double
alpha Double
beta
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a

-- | Create a new operation that holds the process for a random time interval
-- having the Weibull distribution with the specified shape and scale,
-- when processing every input element.
newPreemptibleRandomWeibullOperation :: Bool
                                        -- ^ whether the operation process can be preempted
                                        -> Double
                                        -- ^ shape
                                        -> Double
                                        -- ^ scale
                                        -> Event (Operation a a)
newPreemptibleRandomWeibullOperation :: forall a. Bool -> Double -> Double -> Event (Operation a a)
newPreemptibleRandomWeibullOperation Bool
preemptible Double
alpha Double
beta =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do Double -> Double -> Process ()
randomWeibullProcess_ Double
alpha Double
beta
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a

-- | Create a new operation that holds the process for a random time interval
-- having the specified discrete distribution, when processing every input element.
newPreemptibleRandomDiscreteOperation :: Bool
                                         -- ^ whether the operation process can be preempted
                                         -> DiscretePDF Double
                                         -- ^ the discrete probability density function
                                         -> Event (Operation a a)
newPreemptibleRandomDiscreteOperation :: forall a. Bool -> DiscretePDF Double -> Event (Operation a a)
newPreemptibleRandomDiscreteOperation Bool
preemptible DiscretePDF Double
dpdf =
  Bool -> (a -> Process a) -> Event (Operation a a)
forall a b. Bool -> (a -> Process b) -> Event (Operation a b)
newPreemptibleOperation Bool
preemptible ((a -> Process a) -> Event (Operation a a))
-> (a -> Process a) -> Event (Operation a a)
forall a b. (a -> b) -> a -> b
$ \a
a ->
  do DiscretePDF Double -> Process ()
randomDiscreteProcess_ DiscretePDF Double
dpdf
     a -> Process a
forall a. a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a