-- |
-- Module     : Simulation.Aivika.GPSS.Block.Advance
-- Copyright  : Copyright (c) 2017, David Sorokin <david.sorokin@gmail.com>
-- License    : BSD3
-- Maintainer : David Sorokin <david.sorokin@gmail.com>
-- Stability  : experimental
-- Tested with: GHC 8.0.2
--
-- This module defines the GPSS block ADVANCE.
--
module Simulation.Aivika.GPSS.Block.Advance
       (advanceBlock) where

import Simulation.Aivika
import Simulation.Aivika.GPSS.Block

-- | This is the GPSS construct
--
-- @ADVANCE A,B@
advanceBlock :: Process ()
                -- ^ the delay
                -> Block a a
advanceBlock :: Process () -> Block a a
advanceBlock Process ()
p =
  Block :: forall a b. (a -> Process b) -> Block a b
Block { blockProcess :: a -> Process a
blockProcess = \a
a -> Process ()
p Process () -> Process a -> Process a
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> a -> Process a
forall (m :: * -> *) a. Monad m => a -> m a
return a
a }