ron-0.9: RON

Safe HaskellNone
LanguageHaskell2010

RON.Event.Simulation

Description

Lamport clock network simulation. ReplicaSim provides Replica and Clock instances, replicas may interchange data while they are connected in a NetworkSim.

Synopsis

Documentation

data NetworkSimT m a Source #

Lamport clock simulation. Key is ReplicaId. Non-present value is equivalent to (0, initial).

Instances
MonadTrans NetworkSimT Source # 
Instance details

Defined in RON.Event.Simulation

Methods

lift :: Monad m => m a -> NetworkSimT m a #

MonadError e m => MonadError e (NetworkSimT m) Source # 
Instance details

Defined in RON.Event.Simulation

Methods

throwError :: e -> NetworkSimT m a #

catchError :: NetworkSimT m a -> (e -> NetworkSimT m a) -> NetworkSimT m a #

Monad m => Monad (NetworkSimT m) Source # 
Instance details

Defined in RON.Event.Simulation

Methods

(>>=) :: NetworkSimT m a -> (a -> NetworkSimT m b) -> NetworkSimT m b #

(>>) :: NetworkSimT m a -> NetworkSimT m b -> NetworkSimT m b #

return :: a -> NetworkSimT m a #

fail :: String -> NetworkSimT m a #

Functor m => Functor (NetworkSimT m) Source # 
Instance details

Defined in RON.Event.Simulation

Methods

fmap :: (a -> b) -> NetworkSimT m a -> NetworkSimT m b #

(<$) :: a -> NetworkSimT m b -> NetworkSimT m a #

Monad m => Applicative (NetworkSimT m) Source # 
Instance details

Defined in RON.Event.Simulation

Methods

pure :: a -> NetworkSimT m a #

(<*>) :: NetworkSimT m (a -> b) -> NetworkSimT m a -> NetworkSimT m b #

liftA2 :: (a -> b -> c) -> NetworkSimT m a -> NetworkSimT m b -> NetworkSimT m c #

(*>) :: NetworkSimT m a -> NetworkSimT m b -> NetworkSimT m b #

(<*) :: NetworkSimT m a -> NetworkSimT m b -> NetworkSimT m a #

data ReplicaSimT m a Source #

ReplicaSim inside Lamport clock simulation.

Instances
MonadTrans ReplicaSimT Source # 
Instance details

Defined in RON.Event.Simulation

Methods

lift :: Monad m => m a -> ReplicaSimT m a #

MonadError e m => MonadError e (ReplicaSimT m) Source # 
Instance details

Defined in RON.Event.Simulation

Methods

throwError :: e -> ReplicaSimT m a #

catchError :: ReplicaSimT m a -> (e -> ReplicaSimT m a) -> ReplicaSimT m a #

Monad m => Monad (ReplicaSimT m) Source # 
Instance details

Defined in RON.Event.Simulation

Methods

(>>=) :: ReplicaSimT m a -> (a -> ReplicaSimT m b) -> ReplicaSimT m b #

(>>) :: ReplicaSimT m a -> ReplicaSimT m b -> ReplicaSimT m b #

return :: a -> ReplicaSimT m a #

fail :: String -> ReplicaSimT m a #

Functor m => Functor (ReplicaSimT m) Source # 
Instance details

Defined in RON.Event.Simulation

Methods

fmap :: (a -> b) -> ReplicaSimT m a -> ReplicaSimT m b #

(<$) :: a -> ReplicaSimT m b -> ReplicaSimT m a #

MonadFail m => MonadFail (ReplicaSimT m) Source # 
Instance details

Defined in RON.Event.Simulation

Methods

fail :: String -> ReplicaSimT m a #

Monad m => Applicative (ReplicaSimT m) Source # 
Instance details

Defined in RON.Event.Simulation

Methods

pure :: a -> ReplicaSimT m a #

(<*>) :: ReplicaSimT m (a -> b) -> ReplicaSimT m a -> ReplicaSimT m b #

liftA2 :: (a -> b -> c) -> ReplicaSimT m a -> ReplicaSimT m b -> ReplicaSimT m c #

(*>) :: ReplicaSimT m a -> ReplicaSimT m b -> ReplicaSimT m b #

(<*) :: ReplicaSimT m a -> ReplicaSimT m b -> ReplicaSimT m a #

Monad m => ReplicaClock (ReplicaSimT m) Source # 
Instance details

Defined in RON.Event.Simulation

runNetworkSimT :: Monad m => NetworkSimT m a -> m a Source #

Execute network simulation

Usage:

runExceptT . runNetworkSimT $ do
    runReplicaSimT r1 $ do
        actions...
    runReplicaSimT r2 $ do
        actions...
    runReplicaSimT r1 $ ...

Each runNetworkSimT starts its own networks. One shouldn't use in one network events generated in another.