Copyright | (c) 2011-2015 diagrams-lib team (see LICENSE) |
---|---|

License | BSD-style (see LICENSE) |

Maintainer | diagrams-discuss@googlegroups.com |

Safe Haskell | None |

Language | Haskell2010 |

A module to re-export most of the functionality of the diagrams core and standard library.

- module Diagrams
- module Data.Default.Class
- module Data.Colour
- module Data.Colour.Names
- module Data.Colour.SRGB
- module Data.Semigroup
- module Linear.Vector
- module Linear.Affine
- module Linear.Metric
- module Data.Active
- module Control.Lens
- class Functor f => Applicative f where
- (*>) :: Applicative f => forall a b. f a -> f b -> f b
- (<*) :: Applicative f => forall a b. f a -> f b -> f a
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- (<$) :: Functor f => forall a b. a -> f b -> f a
- liftA :: Applicative f => (a -> b) -> f a -> f b
- liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
- liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d

# Diagrams library

Exports from this library for working with diagrams.

module Diagrams

# Convenience re-exports from other packages

module Data.Default.Class

For representing and operating on colors.

module Data.Colour

A large list of color names.

module Data.Colour.Names

Specify your own colours.

module Data.Colour.SRGB

Semigroups and monoids show up all over the place, so things from Data.Semigroup and Data.Monoid often come in handy.

module Data.Semigroup

For computing with vectors.

module Linear.Vector

For computing with points and vectors.

module Linear.Affine

For computing with dot products and norm.

module Linear.Metric

For working with `Active`

(i.e. animated) things.

module Data.Active

Most of the lens package. The following functions are not exported from lens because they either conflict with diagrams or may conflict with other libraries:

module Control.Lens

class Functor f => Applicative f where

A functor with application, providing operations to

A minimal complete definition must include implementations of these functions satisfying the following laws:

*identity*`pure`

`id`

`<*>`

v = v*composition*`pure`

(.)`<*>`

u`<*>`

v`<*>`

w = u`<*>`

(v`<*>`

w)*homomorphism*`pure`

f`<*>`

`pure`

x =`pure`

(f x)*interchange*u

`<*>`

`pure`

y =`pure`

(`$`

y)`<*>`

u

The other methods have the following default definitions, which may be overridden with equivalent specialized implementations:

As a consequence of these laws, the `Functor`

instance for `f`

will satisfy

If `f`

is also a `Monad`

, it should satisfy

(which implies that `pure`

and `<*>`

satisfy the applicative functor laws).

pure :: a -> f a

Lift a value.

(<*>) :: f (a -> b) -> f a -> f b infixl 4

Sequential application.

(*>) :: f a -> f b -> f b infixl 4

Sequence actions, discarding the value of the first argument.

(<*) :: f a -> f b -> f a infixl 4

Sequence actions, discarding the value of the second argument.

(*>) :: Applicative f => forall a b. f a -> f b -> f b

Sequence actions, discarding the value of the first argument.

(<*) :: Applicative f => forall a b. f a -> f b -> f a

Sequence actions, discarding the value of the second argument.

(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4

An infix synonym for `fmap`

.

#### Examples

Convert from a

to a `Maybe`

`Int`

using `Maybe`

`String`

`show`

:

`>>>`

Nothing`show <$> Nothing`

`>>>`

Just "3"`show <$> Just 3`

Convert from an

to an `Either`

`Int`

`Int`

`Either`

`Int`

`String`

using `show`

:

`>>>`

Left 17`show <$> Left 17`

`>>>`

Right "17"`show <$> Right 17`

Double each element of a list:

`>>>`

[2,4,6]`(*2) <$> [1,2,3]`

Apply `even`

to the second element of a pair:

`>>>`

(2,True)`even <$> (2,2)`

liftA :: Applicative f => (a -> b) -> f a -> f b

liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c

Lift a binary function to actions.

liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d

Lift a ternary function to actions.