-- |
-- Module     : Simulation.Aivika.Trans.GPSS.Block.Priority
-- 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 PRIORITY.
--
module Simulation.Aivika.Trans.GPSS.Block.Priority
       (priorityBlock) where

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

-- | This is the GPSS construct
--
-- @PRIORITY A@
priorityBlock :: MonadDES m 
                 => Int
                 -- ^ the priority
                 -> Block m (Transact m a) (Transact m a)
{-# INLINABLE priorityBlock #-}
priorityBlock :: Int -> Block m (Transact m a) (Transact m a)
priorityBlock Int
priority =
  Block :: forall (m :: * -> *) a b. (a -> Process m b) -> Block m a b
Block { blockProcess :: Transact m a -> Process m (Transact m a)
blockProcess = \Transact m a
a -> Transact m a -> Process m (Transact m a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Transact m a -> Int -> Transact m a
forall (m :: * -> *) a. Transact m a -> Int -> Transact m a
assignTransactPriority Transact m a
a Int
priority) }