|Portability||portable (depends on ghc)|
Many entities of the Ideas framework carry an
Id for identification.
Identifiers have a hierarchical structure of an arbitrary depth (e.g.
a.b.c). Valid symbols for identifiers are the
alpha-numerical characters, together with
_. Each identifier
carries a description and a hash value for fast comparison.
Functionality for identifiers is provided by means of three type classes:
- Type class
IsIdfor constructing identifiers
- Type class
HasIdfor accessing (and changing) the identifier of an entity. Instances of this type class must always have exactly one identifier (although this identifier can be empty).
- Type class
Identifyfor labeling entities with an identifier. Instances of this type class typically allow labels to appear at multiple locations within their structure.
Id datatype implements and re-exports the Monoid interface.
- data Id
- class IsId a where
- (#) :: (IsId a, IsId b) => a -> b -> Id
- class HasId a where
- unqualified :: HasId a => a -> String
- qualifiers :: HasId a => a -> [String]
- qualification :: HasId a => a -> String
- describe :: HasId a => String -> a -> a
- description :: HasId a => a -> String
- showId :: HasId a => a -> String
- compareId :: HasId a => a -> a -> Ordering
- class HasId a => Identify a where
- module Data.Monoid
Abstract data type for identifiers with a hierarchical name, carrying a description. The data type provides a fast comparison implementation.
IsId for constructing identifiers. Examples are
newId ("a", "b", "c"), and
for the empty identifier.
Appends two identifiers. Both parameters are overloaded.
Accessing (and changing) identifiers
Type classfor accessing (and changing) the identifier of an entity.
|HasId (Ref a)|
|HasId (RewriteRule a)|
|HasId (Rule a)|
|HasId (LabeledStrategy a)|
|HasId (Predicate a)|
|HasId (Exercise a)|
|HasId (State a)|
|(HasId a, HasId b) => HasId (Either a b)|
|HasId (Isomorphism a b)|
|HasId (View a b)|
Get the unqualified part of the identifier (i.e., last string).
Get the list of qualifiers of the identifier (i.e., everything but the last string).
Get the qualified part of the identifier. If the identifier consists of
more than one part, the parts are separated by a period (
Give a description for the current entity. If there already is a description, both strings are combined.
Compare two identifiers based on their names. Use
compare for a fast
ordering based on hash values.
Labeling with identifiers
Type class for labeling entities with an identifier