diagrams-lib-1.4.2.3: Embedded domain-specific language for declarative graphics

Copyright(c) 2012 diagrams-lib team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone
LanguageHaskell2010

Diagrams.Coordinates

Description

Nice syntax for constructing and pattern-matching on literal points and vectors.

Synopsis

Documentation

data a :& b infixl 7 #

A pair of values, with a convenient infix (left-associative) data constructor.

Constructors

a :& b infixl 7 
Instances
(Eq a, Eq b) => Eq (a :& b) # 
Instance details

Defined in Diagrams.Coordinates

Methods

(==) :: (a :& b) -> (a :& b) -> Bool #

(/=) :: (a :& b) -> (a :& b) -> Bool #

(Ord a, Ord b) => Ord (a :& b) # 
Instance details

Defined in Diagrams.Coordinates

Methods

compare :: (a :& b) -> (a :& b) -> Ordering #

(<) :: (a :& b) -> (a :& b) -> Bool #

(<=) :: (a :& b) -> (a :& b) -> Bool #

(>) :: (a :& b) -> (a :& b) -> Bool #

(>=) :: (a :& b) -> (a :& b) -> Bool #

max :: (a :& b) -> (a :& b) -> a :& b #

min :: (a :& b) -> (a :& b) -> a :& b #

(Show a, Show b) => Show (a :& b) # 
Instance details

Defined in Diagrams.Coordinates

Methods

showsPrec :: Int -> (a :& b) -> ShowS #

show :: (a :& b) -> String #

showList :: [a :& b] -> ShowS #

Coordinates (a :& b) # 
Instance details

Defined in Diagrams.Coordinates

Associated Types

type FinalCoord (a :& b) :: Type #

type PrevDim (a :& b) :: Type #

type Decomposition (a :& b) :: Type #

Methods

(^&) :: PrevDim (a :& b) -> FinalCoord (a :& b) -> a :& b #

pr :: PrevDim (a :& b) -> FinalCoord (a :& b) -> a :& b #

coords :: (a :& b) -> Decomposition (a :& b) #

type FinalCoord (a :& b) # 
Instance details

Defined in Diagrams.Coordinates

type FinalCoord (a :& b) = b
type PrevDim (a :& b) # 
Instance details

Defined in Diagrams.Coordinates

type PrevDim (a :& b) = a
type Decomposition (a :& b) # 
Instance details

Defined in Diagrams.Coordinates

type Decomposition (a :& b) = a :& b

class Coordinates c where #

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 with the ViewPatterns extension, like so:

foo :: Vector3 -> ...
foo (coords -> x :& y :& z) = ...

Minimal complete definition

(^&), coords

Associated Types

type FinalCoord c :: * #

The type of the final coordinate.

type PrevDim c :: * #

The type of everything other than the final coordinate.

type Decomposition c :: * #

Decomposition of c into applications of :&.

Methods

(^&) :: PrevDim c -> FinalCoord c -> c infixl 7 #

Construct a value of type c by providing something of one less dimension (which is perhaps itself recursively constructed using (^&)) and a final coordinate. For example,

2 ^& 3 :: P2
3 ^& 5 ^& 6 :: V3

Note that ^& is left-associative.

pr :: PrevDim c -> FinalCoord c -> c #

Prefix synonym for ^&. pr stands for pair of PrevDim, FinalCoord

coords :: c -> Decomposition c #

Decompose a value of type c into its constituent coordinates, stored in a nested (:&) structure.

Instances
Coordinates (V4 n) # 
Instance details

Defined in Diagrams.Coordinates

Associated Types

type FinalCoord (V4 n) :: Type #

type PrevDim (V4 n) :: Type #

type Decomposition (V4 n) :: Type #

Methods

(^&) :: PrevDim (V4 n) -> FinalCoord (V4 n) -> V4 n #

pr :: PrevDim (V4 n) -> FinalCoord (V4 n) -> V4 n #

coords :: V4 n -> Decomposition (V4 n) #

Coordinates (V3 n) # 
Instance details

Defined in Diagrams.Coordinates

Associated Types

type FinalCoord (V3 n) :: Type #

type PrevDim (V3 n) :: Type #

type Decomposition (V3 n) :: Type #

Methods

(^&) :: PrevDim (V3 n) -> FinalCoord (V3 n) -> V3 n #

pr :: PrevDim (V3 n) -> FinalCoord (V3 n) -> V3 n #

coords :: V3 n -> Decomposition (V3 n) #

Coordinates (V2 n) # 
Instance details

Defined in Diagrams.Coordinates

Associated Types

type FinalCoord (V2 n) :: Type #

type PrevDim (V2 n) :: Type #

type Decomposition (V2 n) :: Type #

Methods

(^&) :: PrevDim (V2 n) -> FinalCoord (V2 n) -> V2 n #

pr :: PrevDim (V2 n) -> FinalCoord (V2 n) -> V2 n #

coords :: V2 n -> Decomposition (V2 n) #

Coordinates (a, b) # 
Instance details

Defined in Diagrams.Coordinates

Associated Types

type FinalCoord (a, b) :: Type #

type PrevDim (a, b) :: Type #

type Decomposition (a, b) :: Type #

Methods

(^&) :: PrevDim (a, b) -> FinalCoord (a, b) -> (a, b) #

pr :: PrevDim (a, b) -> FinalCoord (a, b) -> (a, b) #

coords :: (a, b) -> Decomposition (a, b) #

Coordinates (v n) => Coordinates (Point v n) # 
Instance details

Defined in Diagrams.Coordinates

Associated Types

type FinalCoord (Point v n) :: Type #

type PrevDim (Point v n) :: Type #

type Decomposition (Point v n) :: Type #

Methods

(^&) :: PrevDim (Point v n) -> FinalCoord (Point v n) -> Point v n #

pr :: PrevDim (Point v n) -> FinalCoord (Point v n) -> Point v n #

coords :: Point v n -> Decomposition (Point v n) #

Coordinates (a :& b) # 
Instance details

Defined in Diagrams.Coordinates

Associated Types

type FinalCoord (a :& b) :: Type #

type PrevDim (a :& b) :: Type #

type Decomposition (a :& b) :: Type #

Methods

(^&) :: PrevDim (a :& b) -> FinalCoord (a :& b) -> a :& b #

pr :: PrevDim (a :& b) -> FinalCoord (a :& b) -> a :& b #

coords :: (a :& b) -> Decomposition (a :& b) #

Coordinates (a, b, c) # 
Instance details

Defined in Diagrams.Coordinates

Associated Types

type FinalCoord (a, b, c) :: Type #

type PrevDim (a, b, c) :: Type #

type Decomposition (a, b, c) :: Type #

Methods

(^&) :: PrevDim (a, b, c) -> FinalCoord (a, b, c) -> (a, b, c) #

pr :: PrevDim (a, b, c) -> FinalCoord (a, b, c) -> (a, b, c) #

coords :: (a, b, c) -> Decomposition (a, b, c) #

Coordinates (a, b, c, d) # 
Instance details

Defined in Diagrams.Coordinates

Associated Types

type FinalCoord (a, b, c, d) :: Type #

type PrevDim (a, b, c, d) :: Type #

type Decomposition (a, b, c, d) :: Type #

Methods

(^&) :: PrevDim (a, b, c, d) -> FinalCoord (a, b, c, d) -> (a, b, c, d) #

pr :: PrevDim (a, b, c, d) -> FinalCoord (a, b, c, d) -> (a, b, c, d) #

coords :: (a, b, c, d) -> Decomposition (a, b, c, d) #