diagrams-core-1.1: Core libraries for diagrams EDSL

Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone

Diagrams.Core.Names

Contents

Description

This module defines a type of names which can be used for referring to subdiagrams, and related types.

Synopsis

Names

Atomic names

data AName whereSource

Atomic names. AName is just an existential wrapper around things which are Typeable, Ord and Show.

Constructors

AName :: (Typeable a, Ord a, Show a) => a -> AName 

Names

newtype Name Source

A (qualified) name is a (possibly empty) sequence of atomic names.

Constructors

Name [AName] 

Instances

Eq Name 
Ord Name 
Show Name 
Typeable Name 
Monoid Name 
Semigroup Name 
Wrapped Name 
Qualifiable Name

Of course, names can be qualified using (.>).

IsName Name 
Rewrapped Name Name 
Action Name a => Action Name (Deletable a) 
Action Name (Trace v) 
Action Name (Envelope v) 
Action Name (Query v m) 
Action Name (SubMap b v m)

A name acts on a name map by qualifying every name in it.

class (Typeable a, Ord a, Show a) => IsName a whereSource

Class for those types which can be used as names. They must support Typeable (to facilitate extracting them from existential wrappers), Ord (for comparison and efficient storage) and Show.

Methods

toName :: a -> NameSource

(.>) :: (IsName a1, IsName a2) => a1 -> a2 -> NameSource

Convenient operator for writing qualified names with atomic components of different types. Instead of writing toName a1 <> toName a2 <> toName a3 you can just write a1 .> a2 .> a3.

Qualifiable

class Qualifiable q whereSource

Instances of Qualifiable are things which can be qualified by prefixing them with a name.

Methods

(|>) :: IsName a => a -> q -> qSource

Qualify with the given name.

Instances

Qualifiable Name

Of course, names can be qualified using (.>).

Qualifiable a => Qualifiable [a] 
(Ord a, Qualifiable a) => Qualifiable (Set a) 
Qualifiable a => Qualifiable (TransInv a) 
Qualifiable a => Qualifiable (b -> a) 
(Qualifiable a, Qualifiable b) => Qualifiable (a, b) 
Qualifiable a => Qualifiable (Map k a) 
(Qualifiable a, Qualifiable b, Qualifiable c) => Qualifiable (a, b, c) 
Qualifiable (SubMap b v m)

SubMaps are qualifiable: if ns is a SubMap, then a |> ns is the same SubMap except with every name qualified by a.

(HasLinearMap v, InnerSpace v, OrderedField (Scalar v), Semigroup m) => Qualifiable (QDiagram b v m)

Diagrams can be qualified so that all their named points can now be referred to using the qualification prefix.