| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Modelling.PetriNet.Parser
Description
Synopsis
- data NoSingletonException
- asSingleton :: MonadThrow m => Set b -> m b
- convertPetri :: MonadThrow m => String -> String -> AlloyInstance -> m Petri
- netToGr :: (Monad m, Net p n, Ord a) => p n a -> m (Gr (a, Maybe Int) Int)
- parseChange :: MonadThrow m => AlloyInstance -> m (PetriChange Object)
- parseNet :: (MonadThrow m, Net p n) => String -> String -> AlloyInstance -> m (p n Object)
- parseRenamedNet :: (MonadThrow m, Net p n) => String -> String -> AlloyInstance -> m (p n String)
- simpleNameMap :: (Net p n, Ord a) => p n a -> Bimap a String
- simpleRename :: Object -> Either String String
- simpleRenameWith :: (MonadThrow m, Net p n, Ord a) => p n a -> a -> m String
Documentation
data NoSingletonException Source #
Constructors
| UnexpectedEmptySet | |
| UnexpectedMultipleElements |
Instances
| Exception NoSingletonException Source # | |
Defined in Modelling.PetriNet.Parser Methods toException :: NoSingletonException -> SomeException # fromException :: SomeException -> Maybe NoSingletonException # | |
| Show NoSingletonException Source # | |
Defined in Modelling.PetriNet.Parser Methods showsPrec :: Int -> NoSingletonException -> ShowS # show :: NoSingletonException -> String # showList :: [NoSingletonException] -> ShowS # | |
asSingleton :: MonadThrow m => Set b -> m b Source #
Arguments
| :: MonadThrow m | |
| => String | the name of the flow set |
| -> String | the name of the token set |
| -> AlloyInstance | the Petri net |
| -> m Petri |
Given the name of a flow set and a token set the given alloy instance is parsed
to a Net graph and a Petri is returned if the instance is indeed a
valid Petri net (after applying petriLikeToPetri).
netToGr :: (Monad m, Net p n, Ord a) => p n a -> m (Gr (a, Maybe Int) Int) Source #
Convert a Net into a Gr enabling to draw it using graphviz.
parseChange :: MonadThrow m => AlloyInstance -> m (PetriChange Object) Source #
Parses a PetriChange given an AlloyInstance.
On error a Left error message will be returned.
Arguments
| :: (MonadThrow m, Net p n) | |
| => String | the name of the flow set |
| -> String | the name of the token set |
| -> AlloyInstance | the Petri net |
| -> m (p n Object) |
Parse a Net graph from an AlloyInstance given the instances flow and
token set names.
parseRenamedNet :: (MonadThrow m, Net p n) => String -> String -> AlloyInstance -> m (p n String) Source #
Parse a Net graph from an AlloyInstance given the instances flow and
token set names.
And return an already renamed Petri net.
simpleNameMap :: (Net p n, Ord a) => p n a -> Bimap a String Source #
Retrieve a simple naming map from a given Net.
The newly created names for naming every PetriNode of the Net are unique
for each individually PetriNode.
Furthermore, each place node's names prefix is a s, while each
transition node's name is preceded by a t.
These prefixes are followed by numbers starting at 1 and reaching to the number
of place nodes and transition nodes respectively.
simpleRenameWith :: (MonadThrow m, Net p n, Ord a) => p n a -> a -> m String Source #
Transform a given value into a String by replacing it according to the
simpleNameMap retrieved by the given Net.