Copyright | (c) Marcellus Siegburg 2019 |
---|---|
License | MIT |
Maintainer | marcellus.siegburg@uni-due.de |
Safe Haskell | None |
Language | Haskell2010 |
This module provides basic functionality to interact with Alloy. This library contains Alloy and an (internal) interface to interact with it. These libraries will be placed into the user's directory during execution. A requirement for this library to work is a Java Runtime Environment (as it is required by Alloy).
Synopsis
- data CallAlloyConfig
- defaultCallAlloyConfig :: CallAlloyConfig
- existsInstance :: String -> IO Bool
- getInstances :: Maybe Integer -> String -> IO [AlloyInstance]
- getInstancesWith :: CallAlloyConfig -> String -> IO [AlloyInstance]
- getSingle :: (IsString s, MonadError s m) => String -> AlloySig -> m (Set Object)
- getDouble :: (IsString s, MonadError s m) => String -> AlloySig -> m (Set (Object, Object))
- getTriple :: (IsString s, MonadError s m) => String -> AlloySig -> m (Set (Object, Object, Object))
- lookupSig :: (IsString s, MonadError s m) => Signature -> AlloyInstance -> m AlloySig
- objectName :: Object -> String
- relToMap :: (IsString s, MonadError s m, Ord k, Ord v) => (a -> (k, v)) -> Set a -> m (Map k (Set v))
- scoped :: String -> String -> Signature
- unscoped :: String -> Signature
- data Object
- data Signature
- type Entries a = a Signature (Entry a Set)
- type AlloySig = Entry Map Set
- type AlloyInstance = Entries Map
Documentation
data CallAlloyConfig Source #
Configuration for calling alloy. These are:
- maximal number of instances to retrieve (
Nothing
for all) - wheather to not overflow when calculating numbers within Alloy
defaultCallAlloyConfig :: CallAlloyConfig Source #
Default configuration for calling Alloy. Defaults to:
- retrieve all instances
- do not overflow
:: String | The Alloy specification which should be loaded. |
-> IO Bool | Whether there exists an instance (within the relevant scope). |
Check if there exists a model for the given specification. This function calls
Alloy retrieving one instance. If there is no such instance, it returns False
.
This function calls getInstances
.
:: Maybe Integer | How many instances to return; |
-> String | The Alloy specification which should be loaded. |
-> IO [AlloyInstance] |
This function may be used to get all model instances for a given Alloy
specification. It calls Alloy via a Java interface and parses the raw instance
answers before returning the resulting list of AlloyInstance
s.
:: CallAlloyConfig | The configuration to be used. |
-> String | The Alloy specification which should be loaded. |
-> IO [AlloyInstance] |
This function may be used to get all model instances for a given Alloy
specification. It calls Alloy via a Java interface and parses the raw instance
answers before returning the resulting list of AlloyInstance
s.
Parameters are set using a CallAlloyConfig
.
getSingle :: (IsString s, MonadError s m) => String -> AlloySig -> m (Set Object) Source #
Retrieve a set of objects of a given AlloySig
.
Successful if the signature's relation is a set (or empty).
getDouble :: (IsString s, MonadError s m) => String -> AlloySig -> m (Set (Object, Object)) Source #
Retrieve a binary relation of objects of a given AlloySig
.
Successful if the signature's relation is binary (or empty).
getTriple :: (IsString s, MonadError s m) => String -> AlloySig -> m (Set (Object, Object, Object)) Source #
Retrieve a ternary relation of objects of a given AlloySig
.
Successful if the signature's relation is ternary (or empty).
lookupSig :: (IsString s, MonadError s m) => Signature -> AlloyInstance -> m AlloySig Source #
Lookup a signature within a given Alloy instance.
objectName :: Object -> String Source #
Retrieve an object's name.
relToMap :: (IsString s, MonadError s m, Ord k, Ord v) => (a -> (k, v)) -> Set a -> m (Map k (Set v)) Source #
Transforms a relation into a Mapping.
Is only successful (i.e. returns return
) if the given transformation function is
able to map the given values injectively.
A concrete instance of an Alloy signature.
An Alloy signature.
type Entries a = a Signature (Entry a Set) Source #
A collection of signatures with associated entries.
type AlloyInstance = Entries Map Source #
A complete Alloy instance.