netrium-0.6.0: Contract normaliser and simulator

Safe HaskellNone
LanguageHaskell98

Interpreter

Contents

Description

Netrium is Copyright Anthony Waite, Dave Hetwett, Shaun Laurens 2009-2015, and files herein are licensed |under the MIT license, the text of which can be found in license.txt

Synopsis

Main interpreter, using observables and choice data

data Output Source #

Instances

Eq Output Source # 

Methods

(==) :: Output -> Output -> Bool #

(/=) :: Output -> Output -> Bool #

Show Output Source # 
XmlContent Output Source # 

Methods

parseContents :: XMLParser Output

toContents :: Output -> [Content ()]

xToChar :: Output -> Char

xFromChar :: Char -> Output

HTypeable Output Source # 

Methods

toHType :: Output -> HType

data StopReason Source #

Constructors

Finished

contract reduced to zero

StoppedTime

stop time reached (in timeout mode)

StoppedWait

stopped at first wait point (in wait mode)

WaitForever

a non-terminating wait

ChoiceRequired Party ChoiceId 
ObservationExhausted VarName 
ObservationMissing VarName

really an error

data SimEnv Source #

Constructors

SimEnv 

Fields

data StopWait Source #

Instances

Eq StopWait Source # 
Show StopWait Source # 
XmlContent StopWait Source # 

Methods

parseContents :: XMLParser StopWait

toContents :: StopWait -> [Content ()]

xToChar :: StopWait -> Char

xFromChar :: Char -> StopWait

HTypeable StopWait Source # 

Methods

toHType :: StopWait -> HType

data WaitInfo Source #

Constructors

WaitInfo 

Instances

Eq WaitInfo Source # 
Show WaitInfo Source # 
XmlContent WaitInfo Source # 

Methods

parseContents :: XMLParser WaitInfo

toContents :: WaitInfo -> [Content ()]

xToChar :: WaitInfo -> Char

xFromChar :: Char -> WaitInfo

HTypeable WaitInfo Source # 

Methods

toHType :: WaitInfo -> HType

runContract Source #

Arguments

:: SimEnv 
-> Time

start time

-> Maybe Time

optional stop time

-> StopWait

stop at first waitpoint

-> Either Contract ProcessState 
-> SimOutputs 

runWait :: SimEnv -> ObsEnv -> Maybe Time -> Time -> [(Obs Bool, k)] -> [(ChoiceId, k)] -> (Time, ObsResult (WaitResult k)) Source #

data WaitEvent k Source #

When in a wait state there are three different things that can happen one of the observables can become true, we can choose to take an anytime option that is available to us.

There are two ways an observable can become true, one is due to a change in a primitive/external ovservable, and the other is via the passage of time.

Hence, overall, there are three events we are interested in while waiting.

Instances

mergeWaitEvents Source #

Arguments

:: Observations Double

time series for real primitive obs

-> Observations Bool

time series for bool primitive obs

-> Choices ()

anytime options taken

-> [(Time, k)]

optional timeouts

-> Time

initial time

-> ObsEnv

initial values of all primitive obs

-> TimedEvents (WaitEvent k) 

Take all three sources of events we are interested in and produce a unified event list

Evaluating observables in the presense of observables data

data ObsEnv Source #

Instances

data ObsResult a Source #

Instances

Functor ObsResult Source # 

Methods

fmap :: (a -> b) -> ObsResult a -> ObsResult b #

(<$) :: a -> ObsResult b -> ObsResult a #

Show a => Show (ObsResult a) Source # 

XML instances

newtype WaitCondition Source #

Constructors

WaitCondition (Obs Bool) 

Instances

XmlContent WaitCondition Source # 
HTypeable WaitCondition Source # 

Methods

toHType :: WaitCondition -> HType

newtype WaitOption Source #

Constructors

WaitOption ChoiceId 

Instances

XmlContent WaitOption Source # 
HTypeable WaitOption Source # 

Methods

toHType :: WaitOption -> HType