-- |
-- Module     : Simulation.Aivika.Trans.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.Trans.GPSS.Block.Advance
       (advanceBlock) where

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

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