|Copyright||(c) 2012 diagrams-lib team (see LICENSE)|
|License||BSD-style (see LICENSE)|
Nice syntax for constructing and pattern-matching on literal points and vectors.
- data a :& b = a :& b
- class Coordinates c where
- class HasX t where
- class HasY t where
- class HasZ t where
- class HasR t where
A pair of values, with a convenient infix (left-associative) data constructor.
|a :& b infixl 7|
Types which are instances of the
Coordinates class can be
constructed using '^&' (for example, a three-dimensional vector
could be constructed by
1 ^& 6 ^& 3), and deconstructed using
coords. A common pattern is to use
coords in conjunction
ViewPatterns extension, like so:
foo :: Vector3 -> ... foo (coords -> x :& y :& z) = ...
The type of the final coordinate.
The type of everything other than the final coordinate.
c into applications of
Construct a value of type
c by providing something of one
less dimension (which is perhaps itself recursively constructed
(^&)) and a final coordinate. For example,
2 ^& 3 :: P2 3 ^& 5 ^& 6 :: R3
^& is left-associative.
Prefix synonym for
^&. pr stands for pair of
Decompose a value of type
c into its constituent coordinates,
stored in a nested
Lenses for particular axes
The class of types with at least one coordinate, called _x.
The class of types with at least two coordinates, the second called _y.
The class of types with at least three coordinates, the third called _z.