motor-0.1.0.0: Type-safe effectful state machines in Haskell

Safe HaskellNone
LanguageHaskell2010

Motor.FSM.Sugar

Description

Syntactic sugar for MonadFSM types.

Synopsis

Documentation

newtype Add s Source #

Action that adds a new resource in state s.

Constructors

Add s 

newtype Delete s Source #

Action that deletes an existing resource in state s.

Constructors

Delete s 

data To a b Source #

Action that transitions the state of an existing resource from state a to b.

Constructors

Transition a b 

data n :-> a infixr 5 Source #

Mapping from Symbol to some action k.

type family FromActions (as :: [*]) (rs :: Row *) :: Row * where ... Source #

Translates a list of Actions to a Row.

Equations

FromActions '[] rs = rs 
FromActions ((n :-> Add a) ': ts) r = Extend n a (FromActions ts r) 
FromActions ((n :-> Delete a) ': ts) r = FromActions ts r :- n 
FromActions ((n :-> To a b) ': ts) r = Extend n b (FromActions ts r :- n) 

type NoActions m r a = m r r a Source #

Alias for MonadFSM that includes no actions.

type Actions m as r a = m r (FromActions as r) a Source #

Alias for MonadFSM that uses FromActions to construct rows.

type OnlyActions m as a = Actions m as Empty a Source #

Alias for MonadFSM that uses FromActions to construct rows, starting from an Empty row, i.e. allowing no other resources.

type (!-->) i o = To i o infixl 6 Source #

Infix version of To.

type (!+) n s = n :-> Add s infix 6 Source #

Add a named resource. Alias of Add.

type (!-) n s = n :-> Delete s infix 6 Source #

Delete a named resource. Alias of Delete.