clafer-0.3.10: clafer compiles Clafer models to other formats, such as Alloy, XML, HTML, Dot.

Safe HaskellNone
LanguageHaskell2010

Language.Clafer.Common

Synopsis

Documentation

getSuper :: IClafer -> [String] Source

Returns only [] or [_]

getReference :: IClafer -> [String] Source

Returns only [] or [_]

getSuperAndReference :: IClafer -> [String] Source

Returns only [] or [_] or [_, _]

findHierarchy :: (IClafer -> [String]) -> UIDIClaferMap -> IClafer -> [IClafer] Source

Finds all super clafers according to sFun

mapHierarchy :: (IClafer -> b) -> (IClafer -> [String]) -> UIDIClaferMap -> IClafer -> [b] Source

Finds hierarchy and transforms each element

findUIDinSupers :: UIDIClaferMap -> UID -> IClafer -> Maybe IClafer Source

traverse the inheritance hierarchy upwards to find a clafer with the given uidToFind

findUIDinParents :: UIDIClaferMap -> UID -> IClafer -> Maybe IClafer Source

traverse the containment hierarchy upwards to find a clafer with the given uidToFind

data NestedInheritanceMatch Source

Constructors

NestedInheritanceMatch 

Fields

_headClafer :: IClafer

the clafer for which the match is computed

_parentClafer :: IClafer

parent of the head clafer

_parentsSuperClafer :: Maybe IClafer

parent of the super of the head clafer

_targetClafer :: Maybe IClafer

target of the head clafer

_targetsSuperClafer :: Maybe IClafer

super of the target of the head clafer

_superClafer :: IClafer

super of the head clafer (must exist, otherwise no match)

_superClafersParent :: IClafer

parent of the super of the head clafer

_superClafersTarget :: Maybe IClafer

target of the super of the head clafer

isProperNesting :: UIDIClaferMap -> Maybe NestedInheritanceMatch -> Bool Source

assumes that isProperNesting m == True

This represents a match of this shape

superClafersParent / <> ?1| * parentsSuperClafer / [=] superClafer --*-> superClafersTarget *| parentClafer | |?2 <> *| [=] targetsSuperClafer * | / | *| headClafer -----*-----> targetClafer

The clafers are obtained by navigating from the headClafer by following the links marked by * The link marked by ?1 is checked for correctness of nesting (isProperNesting): - _uid parentsSuperClafer == _parentUID superClafer The link marked by ?2 is checked for correctness of redefinition (isProperRefinement): - proper subtyping, bag to set, proper cardinality restriction Redefinition occurs when the name of headClafer is the same as the name of superClafer (isProperRedefinition): - isProperNesting && isProperRefinement && (_ident headClafer) == (_ident superClafer)

isProperRefinement :: UIDIClaferMap -> Maybe NestedInheritanceMatch -> (Bool, Bool, Bool) Source

assumes that isProperNesting m == True and isProperRefinement m == (True, True, True)

isRedefinition Source

Arguments

:: Maybe NestedInheritanceMatch 
-> Bool

whether the name of headClafer is the same as superClafer

try to match the nested inheritance pattern ^ only available after the parentUIDs were computed

apply :: forall t t1. (t -> t1) -> t -> (t, t1) Source

bfs :: forall b b1. (b1 -> (b, [b1])) -> [b1] -> [b] Source

lurry :: forall t t1. ([t1] -> t) -> t1 -> t1 -> t Source

fst3 :: forall t t1 t2. (t, t1, t2) -> t Source

snd3 :: forall t t1 t2. (t, t1, t2) -> t1 Source

trd3 :: forall t t1 t2. (t, t1, t2) -> t2 Source

toTriple :: forall t t1 t2. t -> (t1, t2) -> (t, t1, t2) Source

toMTriple :: forall t t1 t2. t -> (t1, t2) -> Maybe (t, t1, t2) Source

keywordIdents :: [String] Source

reserved keywords which cannot be used as clafer identifiers

data GEnv Source

Instances

voidf :: Monad m => m t -> m () Source

safeTail :: [a] -> [a] Source