call-alloy-0.2.0.4: A simple library to call Alloy given a specification
Copyright(c) Marcellus Siegburg 2019
LicenseMIT
Maintainermarcellus.siegburg@uni-due.de
Safe HaskellNone
LanguageHaskell2010

Language.Alloy.Call

Description

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 users directory during execution. A requirement for this library to work is a Java Runtime Environment (as it is required by Alloy).

Synopsis

Documentation

existsInstance Source #

Arguments

:: String

The Alloy specification which should be loaded.

-> IO Bool

Whether there exists an instance (within the given 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.

getInstances Source #

Arguments

:: Maybe Integer

How many instances to return Nothing for all.

-> 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 AlloyInstances.

getSingle :: (IsString s, MonadError s m) => String -> AlloySig -> m (Set Object) Source #

Retrieve a set of objects of a given AlloySig. Successful if the signatures 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 signatures 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 signatures 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 objects 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.

scoped :: String -> String -> Signature Source #

Create a Signature given its scope and name.

unscoped :: String -> Signature Source #

Create an unscoped Signature given its name.

data Object Source #

A concrete instance of an Alloy signature.

Instances

Instances details
Eq Object Source # 
Instance details

Defined in Language.Alloy.Types

Methods

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

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

Ord Object Source # 
Instance details

Defined in Language.Alloy.Types

Show Object Source # 
Instance details

Defined in Language.Alloy.Types

data Signature Source #

An Alloy signature.

Instances

Instances details
Eq Signature Source # 
Instance details

Defined in Language.Alloy.Types

Ord Signature Source # 
Instance details

Defined in Language.Alloy.Types

Show Signature Source # 
Instance details

Defined in Language.Alloy.Types

type Entries a = a Signature (Entry a Set) Source #

A collection of Signatures with associated entries.

type AlloySig = Entry Map Set Source #

A signature with all its objects and relations.

type AlloyInstance = Entries Map Source #

A complete Alloy instance.