Maintainer | diagrams-discuss@googlegroups.com |
---|
This module defines a type of names which can be used for referring to locations within diagrams, and related types.
- data AName
- newtype Name = Name [AName]
- class IsName n where
- class Qualifiable a where
- (||>) :: (IsName n, IsName m) => n -> m -> Name
- newtype NameMap v = NameMap (Map Name [Point v])
- fromNames :: IsName n => [(n, Point v)] -> NameMap v
- rememberAs :: Name -> Point v -> NameMap v -> NameMap v
- lookupN :: IsName n => n -> NameMap v -> Maybe [Point v]
Names
An atomic name is either a number or a string. Numeric names are provided for convenience in naming lists of things, such as a row of ten squares, or the vertices of a path.
A (qualified) name is a (possibly empty) sequence of atomic names. Atomic names can be either numbers or arbitrary strings. Numeric names are provided for convenience in naming lists of things, such as a row of ten squares, or the vertices of a path.
Instaces of IsName
are things which can be converted to names.
class Qualifiable a whereSource
Instances of Qualifiable
are things which can be qualified by
prefixing them with a name.
Qualifiable Name | Names can be qualified by prefixing them with other names. |
Qualifiable (NameMap v) |
|
(HasLinearMap v, InnerSpace v, OrderedField (Scalar v), Monoid m) => Qualifiable (AnnDiagram b v m) | Diagrams can be qualified so that all their named points can now be referred to using the qualification prefix. |
(||>) :: (IsName n, IsName m) => n -> m -> NameSource
Convenient operator for writing complete names in the form a1 |>
a2 |> a3 ||> a4
. In particular, n1 ||> n2
is equivalent to
n1 |> toName n2
.
Name maps
A NameMap
is a map from names to points, possibly with
multiple points associated with each name.
Action Name (NameMap v) | A name acts on a name map by qualifying every name in it. |
Monoid (NameMap v) |
|
VectorSpace v => HasOrigin (NameMap v) | |
Qualifiable (NameMap v) |
|
HasLinearMap v => Transformable (NameMap v) |
Constructing name maps
fromNames :: IsName n => [(n, Point v)] -> NameMap vSource
Construct a NameMap
from a list of (name, point) pairs.