Safe Haskell | Safe-Inferred |
---|
Well-formedness checks for finite state machines.
- data WellFormed sy
- = BadLengths [(sy, Int)]
- | BadActions [(sy, Action)]
- | Disconnected [[State]]
- | WellFormed
- isWellFormed :: Ord sy => FSM sy -> WellFormed sy
- polishFSM :: (Ord sy, Show sy) => FSM sy -> ReadFsmMonad (FSM sy)
Documentation
data WellFormed sy Source
An FSM
is well-formed if all its actions are the same length,
none of its actions contain destinations which are out of range,
and it is not disjoint.
BadLengths [(sy, Int)] | Lengths of Actions in the |
BadActions [(sy, Action)] | Some |
Disconnected [[State]] | The FSM is disconnected, i.e. not even weakly-connected.
Carries a list of its weakly-connected components (each is a
list of |
WellFormed | Well-formed. |
Eq sy => Eq (WellFormed sy) | |
Show sy => Show (WellFormed sy) |
isWellFormed :: Ord sy => FSM sy -> WellFormed sySource
Check if an FSM
is well-formed or not.
polishFSM :: (Ord sy, Show sy) => FSM sy -> ReadFsmMonad (FSM sy)Source
Given an FSM, normalise it and check it's well-formed.
This should be called whenever an FSM is read/computed from an outside source. If parsing, the right time to call this is immediately after you've decided if the parse of the FSM was successful or not. (In other words, here are some static checks!)