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

Safe HaskellNone




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


Core library

The core definitions of transformations, diagrams, backends, and so on.

Standard library

Attributes (color, line style, etc.) and styles.

Alignment of diagrams relative to their envelopes.

Combining multiple diagrams into one.

Giving concrete locations to translation-invariant things.

Linear and cubic bezier segments.


Parametrization of segments and trails.

Trail-like things.


Cubic splines.

Some additional transformation-related functions, like conjugation of transformations.

Convenient definitions and utilities for working with good old-fashioned, axis-aligned bounding boxes.

Giving names to subdiagrams and later retrieving subdiagrams by name.

Envelopes, aka functional bounding regions.

Traces, aka embedded raytracers, for finding points on the boundary of a diagram.

A query is a function that maps points in a vector space to values in some monoid; they can be used to annotate the points of a diagram with some values.

Utilities for working with points.

A wide range of things (shapes, transformations, combinators) specific to creating two-dimensional diagrams.

Tools for making animations.

Various utility definitions.

Convenience re-exports

For representing and operating on colors.

A large list of color names.

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

For computing with vectors.

For computing with points and vectors.

For working with Active (i.e. animated) things.

class Functor f => Applicative f where

A functor with application, providing operations to

  • embed pure expressions (pure), and
  • sequence computations and combine their results (<*>).

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

pure id <*> v = v
pure (.) <*> u <*> v <*> w = u <*> (v <*> w)
pure f <*> pure x = pure (f x)
u <*> pure y = pure ($ y) <*> u

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

      u *> v = pure (const id) <*> u <*> v
      u <* v = pure const <*> u <*> v

As a consequence of these laws, the Functor instance for f will satisfy

      fmap f x = pure f <*> x

If f is also a Monad, it should satisfy pure = return and (<*>) = ap (which implies that pure and <*> satisfy the applicative functor laws).


pure :: a -> f a

Lift a value.

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

Sequential application.

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

Sequence actions, discarding the value of the first argument.

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

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

An infix synonym for fmap.

(<$) :: Functor f => forall a b. a -> f b -> f a

Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.

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

Lift a function to actions. This function may be used as a value for fmap in a Functor instance.

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.