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

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

Diagrams.Query

Description

A query is a function that maps points in a vector space to values in some monoid. Queries naturally form a monoid, with two queries being combined pointwise.

Synopsis

Documentation

newtype Query v n m :: (* -> *) -> * -> * -> * #

A query is a function that maps points in a vector space to values in some monoid. Queries naturally form a monoid, with two queries being combined pointwise.

The idea for annotating diagrams with monoidal queries came from the graphics-drawingcombinators package, http://hackage.haskell.org/package/graphics-drawingcombinators.

Constructors

Query 

Fields

Instances

Functor (Query v n) 

Methods

fmap :: (a -> b) -> Query v n a -> Query v n b #

(<$) :: a -> Query v n b -> Query v n a #

Applicative (Query v n) 

Methods

pure :: a -> Query v n a #

(<*>) :: Query v n (a -> b) -> Query v n a -> Query v n b #

(*>) :: Query v n a -> Query v n b -> Query v n b #

(<*) :: Query v n a -> Query v n b -> Query v n a #

Semigroup m => Semigroup (Query v n m) 

Methods

(<>) :: Query v n m -> Query v n m -> Query v n m #

sconcat :: NonEmpty (Query v n m) -> Query v n m #

stimes :: Integral b => b -> Query v n m -> Query v n m #

Monoid m => Monoid (Query v n m) 

Methods

mempty :: Query v n m #

mappend :: Query v n m -> Query v n m -> Query v n m #

mconcat :: [Query v n m] -> Query v n m #

(Additive v, Num n) => Transformable (Query v n m) 

Methods

transform :: Transformation (V (Query v n m)) (N (Query v n m)) -> Query v n m -> Query v n m #

(Additive v, Num n) => HasOrigin (Query v n m) 

Methods

moveOriginTo :: Point (V (Query v n m)) (N (Query v n m)) -> Query v n m -> Query v n m #

Wrapped (Query v n m) 

Associated Types

type Unwrapped (Query v n m) :: * #

Methods

_Wrapped' :: Iso' (Query v n m) (Unwrapped (Query v n m)) #

Rewrapped (Query v a m) (Query v' a' m') 
type V (Query v n m) 
type V (Query v n m) = v
type N (Query v n m) 
type N (Query v n m) = n
type Unwrapped (Query v n m) 
type Unwrapped (Query v n m) = Point v n -> m

query :: Monoid m => QDiagram b v n m -> Query v n m #

Get the query function associated with a diagram.

sample :: Monoid m => QDiagram b v n m -> Point v n -> m #

Sample a diagram's query function at a given point.

value :: Monoid m => m -> QDiagram b v n Any -> QDiagram b v n m #

Set the query value for True points in a diagram (i.e. points "inside" the diagram); False points will be set to mempty.

resetValue :: (Eq m, Monoid m) => QDiagram b v n m -> QDiagram b v n Any #

Reset the query values of a diagram to True/False: any values equal to mempty are set to False; any other values are set to True.

clearValue :: QDiagram b v n m -> QDiagram b v n Any #

Set all the query values of a diagram to False.