-- |
-- Module     : Simulation.Aivika.Server.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 servers that
-- hold the current process for the corresponding random time
-- interval, when processing every input element.
--

module Simulation.Aivika.Server.Random
       (newRandomUniformServer,
        newRandomUniformIntServer,
        newRandomTriangularServer,
        newRandomNormalServer,
        newRandomLogNormalServer,
        newRandomExponentialServer,
        newRandomErlangServer,
        newRandomPoissonServer,
        newRandomBinomialServer,
        newRandomGammaServer,
        newRandomBetaServer,
        newRandomWeibullServer,
        newRandomDiscreteServer,
        newPreemptibleRandomUniformServer,
        newPreemptibleRandomUniformIntServer,
        newPreemptibleRandomTriangularServer,
        newPreemptibleRandomNormalServer,
        newPreemptibleRandomLogNormalServer,
        newPreemptibleRandomExponentialServer,
        newPreemptibleRandomErlangServer,
        newPreemptibleRandomPoissonServer,
        newPreemptibleRandomBinomialServer,
        newPreemptibleRandomGammaServer,
        newPreemptibleRandomBetaServer,
        newPreemptibleRandomWeibullServer,
        newPreemptibleRandomDiscreteServer) where

import Simulation.Aivika.Generator
import Simulation.Aivika.Simulation
import Simulation.Aivika.Process
import Simulation.Aivika.Process.Random
import Simulation.Aivika.Server

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

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

-- | Create a new server 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 server process cannot be preempted,
-- because the handling of possible task preemption is rather costly
-- operation.
newRandomTriangularServer :: Double
                             -- ^ the minimum time interval
                             -> Double
                             -- ^ the median of the time interval
                             -> Double
                             -- ^ the maximum time interval
                             -> Simulation (Server () a a)
newRandomTriangularServer :: forall a. Double -> Double -> Double -> Simulation (Server () a a)
newRandomTriangularServer =
  Bool -> Double -> Double -> Double -> Simulation (Server () a a)
forall a.
Bool -> Double -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomTriangularServer Bool
False

-- | Create a new server that holds the process for a random time interval
-- distributed normally, when processing every input element.
--
-- By default, it is assumed that the server process cannot be preempted,
-- because the handling of possible task preemption is rather costly
-- operation.
newRandomNormalServer :: Double
                         -- ^ the mean time interval
                         -> Double
                         -- ^ the time interval deviation
                         -> Simulation (Server () a a)
newRandomNormalServer :: forall a. Double -> Double -> Simulation (Server () a a)
newRandomNormalServer =
  Bool -> Double -> Double -> Simulation (Server () a a)
forall a. Bool -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomNormalServer Bool
False
         
-- | Create a new server 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 server process cannot be preempted,
-- because the handling of possible task preemption is rather costly
-- operation.
newRandomLogNormalServer :: 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
                            -> Simulation (Server () a a)
newRandomLogNormalServer :: forall a. Double -> Double -> Simulation (Server () a a)
newRandomLogNormalServer =
  Bool -> Double -> Double -> Simulation (Server () a a)
forall a. Bool -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomLogNormalServer Bool
False

-- | Create a new server 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 server process cannot be preempted,
-- because the handling of possible task preemption is rather costly
-- operation.
newRandomExponentialServer :: Double
                              -- ^ the mean time interval (the reciprocal of the rate)
                              -> Simulation (Server () a a)
newRandomExponentialServer :: forall a. Double -> Simulation (Server () a a)
newRandomExponentialServer =
  Bool -> Double -> Simulation (Server () a a)
forall a. Bool -> Double -> Simulation (Server () a a)
newPreemptibleRandomExponentialServer Bool
False
         
-- | Create a new server 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 server process cannot be preempted,
-- because the handling of possible task preemption is rather costly
-- operation.
newRandomErlangServer :: Double
                         -- ^ the scale (the reciprocal of the rate)
                         -> Int
                         -- ^ the shape
                         -> Simulation (Server () a a)
newRandomErlangServer :: forall a. Double -> Int -> Simulation (Server () a a)
newRandomErlangServer =
  Bool -> Double -> Int -> Simulation (Server () a a)
forall a. Bool -> Double -> Int -> Simulation (Server () a a)
newPreemptibleRandomErlangServer Bool
False

-- | Create a new server 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 server process cannot be preempted,
-- because the handling of possible task preemption is rather costly
-- operation.
newRandomPoissonServer :: Double
                          -- ^ the mean time interval
                          -> Simulation (Server () a a)
newRandomPoissonServer :: forall a. Double -> Simulation (Server () a a)
newRandomPoissonServer =
  Bool -> Double -> Simulation (Server () a a)
forall a. Bool -> Double -> Simulation (Server () a a)
newPreemptibleRandomPoissonServer Bool
False

-- | Create a new server 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 server process cannot be preempted,
-- because the handling of possible task preemption is rather costly
-- operation.
newRandomBinomialServer :: Double
                           -- ^ the probability
                           -> Int
                           -- ^ the number of trials
                           -> Simulation (Server () a a)
newRandomBinomialServer :: forall a. Double -> Int -> Simulation (Server () a a)
newRandomBinomialServer =
  Bool -> Double -> Int -> Simulation (Server () a a)
forall a. Bool -> Double -> Int -> Simulation (Server () a a)
newPreemptibleRandomBinomialServer Bool
False

-- | Create a new server 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 server process cannot be preempted,
-- because the handling of possible task preemption is rather costly
-- operation.
newRandomGammaServer :: Double
                        -- ^ the shape
                        -> Double
                        -- ^ the scale (a reciprocal of the rate)
                        -> Simulation (Server () a a)
newRandomGammaServer :: forall a. Double -> Double -> Simulation (Server () a a)
newRandomGammaServer =
  Bool -> Double -> Double -> Simulation (Server () a a)
forall a. Bool -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomGammaServer Bool
False

-- | Create a new server 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 server process cannot be preempted,
-- because the handling of possible task preemption is rather costly
-- operation.
newRandomBetaServer :: Double
                       -- ^ shape (alpha)
                       -> Double
                       -- ^ shape (beta)
                       -> Simulation (Server () a a)
newRandomBetaServer :: forall a. Double -> Double -> Simulation (Server () a a)
newRandomBetaServer =
  Bool -> Double -> Double -> Simulation (Server () a a)
forall a. Bool -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomBetaServer Bool
False

-- | Create a new server 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 server process cannot be preempted,
-- because the handling of possible task preemption is rather costly
-- operation.
newRandomWeibullServer :: Double
                          -- ^ shape
                          -> Double
                          -- ^ scale
                          -> Simulation (Server () a a)
newRandomWeibullServer :: forall a. Double -> Double -> Simulation (Server () a a)
newRandomWeibullServer =
  Bool -> Double -> Double -> Simulation (Server () a a)
forall a. Bool -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomWeibullServer Bool
False

-- | Create a new server 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 server process cannot be preempted,
-- because the handling of possible task preemption is rather costly
-- operation.
newRandomDiscreteServer :: DiscretePDF Double
                           -- ^ the discrete probability density function
                           -> Simulation (Server () a a)
newRandomDiscreteServer :: forall a. DiscretePDF Double -> Simulation (Server () a a)
newRandomDiscreteServer =
  Bool -> DiscretePDF Double -> Simulation (Server () a a)
forall a. Bool -> DiscretePDF Double -> Simulation (Server () a a)
newPreemptibleRandomDiscreteServer Bool
False

-- | Create a new server that holds the process for a random time interval
-- distributed uniformly, when processing every input element.
newPreemptibleRandomUniformServer :: Bool
                                     -- ^ whether the server process can be preempted
                                     -> Double
                                     -- ^ the minimum time interval
                                     -> Double
                                     -- ^ the maximum time interval
                                     -> Simulation (Server () a a)
newPreemptibleRandomUniformServer :: forall a. Bool -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomUniformServer Bool
preemptible Double
min Double
max =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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 server that holds the process for a random time interval
-- distributed uniformly, when processing every input element.
newPreemptibleRandomUniformIntServer :: Bool
                                        -- ^ whether the server process can be preempted
                                        -> Int
                                        -- ^ the minimum time interval
                                        -> Int
                                        -- ^ the maximum time interval
                                        -> Simulation (Server () a a)
newPreemptibleRandomUniformIntServer :: forall a. Bool -> Int -> Int -> Simulation (Server () a a)
newPreemptibleRandomUniformIntServer Bool
preemptible Int
min Int
max =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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 server that holds the process for a random time interval
-- having the triangular distribution, when processing every input element.
newPreemptibleRandomTriangularServer :: Bool
                                        -- ^ whether the server process can be preempted
                                        -> Double
                                        -- ^ the minimum time interval
                                        -> Double
                                        -- ^ the median of the time interval
                                        -> Double
                                        -- ^ the maximum time interval
                                        -> Simulation (Server () a a)
newPreemptibleRandomTriangularServer :: forall a.
Bool -> Double -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomTriangularServer Bool
preemptible Double
min Double
median Double
max =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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 server that holds the process for a random time interval
-- distributed normally, when processing every input element.
newPreemptibleRandomNormalServer :: Bool
                                    -- ^ whether the server process can be preempted
                                    -> Double
                                    -- ^ the mean time interval
                                    -> Double
                                    -- ^ the time interval deviation
                                    -> Simulation (Server () a a)
newPreemptibleRandomNormalServer :: forall a. Bool -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomNormalServer Bool
preemptible Double
mu Double
nu =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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 server that holds the process for a random time interval
-- having the lognormal distribution, when processing every input element.
newPreemptibleRandomLogNormalServer :: Bool
                                       -- ^ whether the server 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
                                       -> Simulation (Server () a a)
newPreemptibleRandomLogNormalServer :: forall a. Bool -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomLogNormalServer Bool
preemptible Double
mu Double
nu =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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 server 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.
newPreemptibleRandomExponentialServer :: Bool
                                         -- ^ whether the server process can be preempted
                                         -> Double
                                         -- ^ the mean time interval (the reciprocal of the rate)
                                         -> Simulation (Server () a a)
newPreemptibleRandomExponentialServer :: forall a. Bool -> Double -> Simulation (Server () a a)
newPreemptibleRandomExponentialServer Bool
preemptible Double
mu =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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 server 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.
newPreemptibleRandomErlangServer :: Bool
                                    -- ^ whether the server process can be preempted
                                    -> Double
                                    -- ^ the scale (the reciprocal of the rate)
                                    -> Int
                                    -- ^ the shape
                                    -> Simulation (Server () a a)
newPreemptibleRandomErlangServer :: forall a. Bool -> Double -> Int -> Simulation (Server () a a)
newPreemptibleRandomErlangServer Bool
preemptible Double
beta Int
m =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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 server that holds the process for a random time interval
-- having the Poisson distribution with the specified mean, when processing
-- every input element.
newPreemptibleRandomPoissonServer :: Bool
                                     -- ^ whether the server process can be preempted
                                     -> Double
                                     -- ^ the mean time interval
                                  -> Simulation (Server () a a)
newPreemptibleRandomPoissonServer :: forall a. Bool -> Double -> Simulation (Server () a a)
newPreemptibleRandomPoissonServer Bool
preemptible Double
mu =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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 server that holds the process for a random time interval
-- having the binomial distribution with the specified probability and trials,
-- when processing every input element.
newPreemptibleRandomBinomialServer :: Bool
                                     -- ^ whether the server process can be preempted
                                     -> Double
                                     -- ^ the probability
                                     -> Int
                                     -- ^ the number of trials
                                     -> Simulation (Server () a a)
newPreemptibleRandomBinomialServer :: forall a. Bool -> Double -> Int -> Simulation (Server () a a)
newPreemptibleRandomBinomialServer Bool
preemptible Double
prob Int
trials =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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 server that holds the process for a random time interval
-- having the Gamma distribution with the specified shape and scale,
-- when processing every input element.
newPreemptibleRandomGammaServer :: Bool
                                   -- ^ whether the server process can be preempted
                                   -> Double
                                   -- ^ the shape
                                   -> Double
                                   -- ^ the scale (a reciprocal of the rate)
                                   -> Simulation (Server () a a)
newPreemptibleRandomGammaServer :: forall a. Bool -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomGammaServer Bool
preemptible Double
kappa Double
theta =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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 server 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.
newPreemptibleRandomBetaServer :: Bool
                                  -- ^ whether the server process can be preempted
                                  -> Double
                                  -- ^ shape (alpha)
                                  -> Double
                                  -- ^ shape (beta)
                                  -> Simulation (Server () a a)
newPreemptibleRandomBetaServer :: forall a. Bool -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomBetaServer Bool
preemptible Double
alpha Double
beta =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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 server that holds the process for a random time interval
-- having the Weibull distribution with the specified shape and scale,
-- when processing every input element.
newPreemptibleRandomWeibullServer :: Bool
                                  -- ^ whether the server process can be preempted
                                  -> Double
                                  -- ^ shape
                                  -> Double
                                  -- ^ scale
                                  -> Simulation (Server () a a)
newPreemptibleRandomWeibullServer :: forall a. Bool -> Double -> Double -> Simulation (Server () a a)
newPreemptibleRandomWeibullServer Bool
preemptible Double
alpha Double
beta =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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 server that holds the process for a random time interval
-- having the specified discrete distribution, when processing every input element.
newPreemptibleRandomDiscreteServer :: Bool
                                      -- ^ whether the server process can be preempted
                                      -> DiscretePDF Double
                                      -- ^ the discrete probability density function
                                      -> Simulation (Server () a a)
newPreemptibleRandomDiscreteServer :: forall a. Bool -> DiscretePDF Double -> Simulation (Server () a a)
newPreemptibleRandomDiscreteServer Bool
preemptible DiscretePDF Double
dpdf =
  Bool -> (a -> Process a) -> Simulation (Server () a a)
forall a b. Bool -> (a -> Process b) -> Simulation (Server () a b)
newPreemptibleServer Bool
preemptible ((a -> Process a) -> Simulation (Server () a a))
-> (a -> Process a) -> Simulation (Server () 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