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

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

Diagrams.Prelude

Contents

Description

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

Synopsis

Diagrams library

Exports from this library for working with diagrams.

module Diagrams

Convenience re-exports from other packages

For working with default values. Diagrams also exports with, an alias for def.

For representing and operating on colors.

A large list of color names.

Specify your own colours.

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 computing with dot products and norm.

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

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:

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:

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).

Minimal complete definition

pure, (<*>)

Methods

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.

Instances

Applicative [] 
Applicative IO 
Applicative Q 
Applicative Active 
Applicative Duration 
Applicative Id 
Applicative P 
Applicative Identity 
Applicative ZipList 
Applicative STM 
Applicative First 
Applicative Last 
Applicative ReadPrec 
Applicative ReadP 
Applicative Maybe 
Applicative Get 
Applicative Put 
Applicative Get 
Applicative RGB 
Applicative Tree 
Applicative Seq 
Applicative Interval 
Applicative Vector 
Applicative Quaternion 
Applicative Plucker 
Applicative V4 
Applicative V3 
Applicative V2 
Applicative V1 
Applicative V0 
Applicative ReadM 
Applicative Parser 
Applicative ParserM 
Applicative ParserResult 
Applicative Chunk 
Applicative Min 
Applicative Max 
Applicative First 
Applicative Last 
Applicative Option 
Applicative NonEmpty 
Applicative Id 
Applicative Box 
Applicative Stream 
Applicative Angle 
Applicative Id 
Applicative ((->) a) 
Applicative (Either e) 
Monoid a => Applicative ((,) a) 
Representable f => Applicative (Co f) 
Applicative (ST s) 
Applicative (StateL s) 
Applicative (StateR s) 
Applicative (ST s) 
Monoid m => Applicative (Const m) 
Monad m => Applicative (WrappedMonad m) 
Arrow a => Applicative (ArrowMonad a) 
Applicative (Proxy *) 
Applicative m => Applicative (IdentityT m) 
Applicative (State s) 
Applicative (Measured n) 
Applicative f => Applicative (Point f) 
Alternative f => Applicative (Cofree f) 
Applicative f => Applicative (Yoneda f) 
Applicative f => Applicative (Backwards f)

Apply f-actions in the reverse order.

Applicative m => Applicative (ListT m) 
(Functor m, Monad m) => Applicative (MaybeT m) 
Applicative (ReifiedGetter s) 
Applicative (ReifiedFold s) 
Applicative f => Applicative (Indexing f) 
Applicative f => Applicative (Indexing64 f) 
(Applicative (Rep p), Representable p) => Applicative (Prep p) 
Applicative f => Applicative (WrappedApplicative f) 
Apply f => Applicative (MaybeApply f) 
Applicative f => Applicative (Reverse f)

Derived instance.

Monoid a => Applicative (Constant a) 
Applicative (StateR s) 
Applicative (StateL s) 
Arrow a => Applicative (WrappedArrow a b) 
Applicative f => Applicative (Alt * f) 
Applicative w => Applicative (TracedT m w) 
Applicative (Cokleisli w a) 
Applicative (Query v n) 
(Applicative f, Applicative g) => Applicative (Day f g) 
(Applicative f, Applicative g) => Applicative (Compose f g) 
(Functor m, Monad m) => Applicative (ErrorT e m) 
Applicative (Indexed i a) 
(Monad m, Monoid s) => Applicative (Focusing m s) 
Applicative (k (May s)) => Applicative (FocusingMay k s) 
(Monad m, Monoid r) => Applicative (Effect m r) 
Dim k n => Applicative (V k n) 
Applicative (ContT r m) 
Applicative m => Applicative (ReaderT r m) 
(Functor m, Monad m) => Applicative (StateT s m) 
(Functor m, Monad m) => Applicative (StateT s m) 
(Functor m, Monad m) => Applicative (ExceptT e m) 
(Monoid w, Applicative m) => Applicative (WriterT w m) 
(Monoid w, Applicative m) => Applicative (WriterT w m) 
(Profunctor p, Arrow p) => Applicative (Closure p a) 
(Profunctor p, Arrow p) => Applicative (Tambara p a) 
Applicative f => Applicative (Star f a) 
Applicative (Costar f a) 
Applicative (Tagged k s) 
(Applicative f, Applicative g) => Applicative (Product f g) 
Biapplicative p => Applicative (Join * p) 
(Monad m, Monoid s, Monoid w) => Applicative (FocusingWith w m s) 
Applicative (k (s, w)) => Applicative (FocusingPlus w k s) 
Applicative (k (f s)) => Applicative (FocusingOn f k s) 
Applicative (k (Err e s)) => Applicative (FocusingErr e k s) 
(Monoid s, Monoid w, Monad m) => Applicative (EffectRWS w st m s) 
(Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) 
(Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) 
Reifies k s (ReifiedApplicative f) => Applicative (ReflectedApplicative k * f s) 

(*>) :: 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 Maybe Int to a Maybe String using show:

>>> show <$> Nothing
Nothing
>>> show <$> Just 3
Just "3"

Convert from an Either Int Int to an Either Int String using show:

>>> show <$> Left 17
Left 17
>>> show <$> Right 17
Right "17"

Double each element of a list:

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

Apply even to the second element of a pair:

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

(<$) :: 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.