diagrams-lib-1.4.2.2: 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 Source #

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

Constructors

a :& b infixl 7 

Instances

(Eq b, Eq a) => Eq ((:&) a b) Source # 

Methods

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

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

(Ord b, Ord a) => Ord ((:&) a b) Source # 

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 b, Show a) => Show ((:&) a b) Source # 

Methods

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

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

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

Coordinates ((:&) a b) Source # 

Associated Types

type FinalCoord (a :& b) :: * Source #

type PrevDim (a :& b) :: * Source #

type Decomposition (a :& b) :: * Source #

Methods

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

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

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

type FinalCoord ((:&) a b) Source # 
type FinalCoord ((:&) a b) = b
type PrevDim ((:&) a b) Source # 
type PrevDim ((:&) a b) = a
type Decomposition ((:&) a b) Source # 
type Decomposition ((:&) a b) = (:&) a b

class Coordinates c where Source #

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 :: * Source #

The type of the final coordinate.

type PrevDim c :: * Source #

The type of everything other than the final coordinate.

type Decomposition c :: * Source #

Decomposition of c into applications of :&.

Methods

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

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 Source #

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

coords :: c -> Decomposition c Source #

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

Instances

Coordinates (V4 n) Source # 

Associated Types

type FinalCoord (V4 n) :: * Source #

type PrevDim (V4 n) :: * Source #

type Decomposition (V4 n) :: * Source #

Methods

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

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

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

Coordinates (V3 n) Source # 

Associated Types

type FinalCoord (V3 n) :: * Source #

type PrevDim (V3 n) :: * Source #

type Decomposition (V3 n) :: * Source #

Methods

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

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

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

Coordinates (V2 n) Source # 

Associated Types

type FinalCoord (V2 n) :: * Source #

type PrevDim (V2 n) :: * Source #

type Decomposition (V2 n) :: * Source #

Methods

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

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

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

Coordinates (a, b) Source # 

Associated Types

type FinalCoord (a, b) :: * Source #

type PrevDim (a, b) :: * Source #

type Decomposition (a, b) :: * Source #

Methods

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

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

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

Coordinates (v n) => Coordinates (Point v n) Source # 

Associated Types

type FinalCoord (Point v n) :: * Source #

type PrevDim (Point v n) :: * Source #

type Decomposition (Point v n) :: * Source #

Methods

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

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

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

Coordinates ((:&) a b) Source # 

Associated Types

type FinalCoord (a :& b) :: * Source #

type PrevDim (a :& b) :: * Source #

type Decomposition (a :& b) :: * Source #

Methods

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

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

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

Coordinates (a, b, c) Source # 

Associated Types

type FinalCoord (a, b, c) :: * Source #

type PrevDim (a, b, c) :: * Source #

type Decomposition (a, b, c) :: * Source #

Methods

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

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

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

Coordinates (a, b, c, d) Source # 

Associated Types

type FinalCoord (a, b, c, d) :: * Source #

type PrevDim (a, b, c, d) :: * Source #

type Decomposition (a, b, c, d) :: * Source #

Methods

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

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

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