Copyright | (c) 2013 diagrams-lib team (see LICENSE) |
---|---|

License | BSD-style (see LICENSE) |

Maintainer | diagrams-discuss@googlegroups.com |

Safe Haskell | None |

Language | Haskell2010 |

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.

- newtype Query v n m :: (* -> *) -> * -> * -> * = Query {}
- class HasQuery t m | t -> m where
- sample :: HasQuery t m => t -> Point (V t) (N t) -> m
- inquire :: HasQuery t Any => t -> Point (V t) (N t) -> Bool
- query :: Monoid m => QDiagram b v n m -> Query v n m
- value :: Monoid m => m -> QDiagram b v n Any -> QDiagram b v n m
- resetValue :: (Eq m, Monoid m) => QDiagram b v n m -> QDiagram b v n Any
- clearValue :: QDiagram b v n m -> QDiagram b v n Any

# Queries

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.

Functor v => Corepresentable (Query v) | |

Functor v => Profunctor (Query v) | |

Functor v => Closed (Query v) | |

Functor v => Costrong (Query v) | |

Functor v => Cosieve (Query v) (Point v) | |

Monad (Query v n) | |

Functor (Query v n) | |

Applicative (Query v n) | |

Distributive (Query v n) | |

Representable (Query v n) | |

Semigroup m => Semigroup (Query v n m) | |

Monoid m => Monoid (Query v n m) | |

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

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

Wrapped (Query v n m) | |

HasQuery (Query v n m) m # | |

Rewrapped (Query v a m) (Query v' a' m') | |

type Corep (Query v) | |

type Rep (Query v n) | |

type V (Query v n m) | |

type N (Query v n m) | |

type Unwrapped (Query v n m) | |

class HasQuery t m | t -> m where #

Types which can answer a `Query`

about points inside the geometric
object.

If `t`

and `m`

are both a `Semigroup`

s, `getQuery`

should satisfy

`getQuery`

(t1 <> t2) =`getQuery`

t1 <>`getQuery`

t2

(Floating n, Ord n) => HasQuery (CSG n) Any # | |

OrderedField n => HasQuery (Frustum n) Any # | |

(Num n, Ord n) => HasQuery (Box n) Any # | |

(Num n, Ord n) => HasQuery (Ellipsoid n) Any # | |

RealFloat n => HasQuery (Clip n) All # | A point inside a clip if the point is in |

(Additive v, Foldable v, Ord n) => HasQuery (BoundingBox v n) Any # | |

RealFloat n => HasQuery (DImage n a) Any # | |

HasQuery (Query v n m) m # | |

Monoid m => HasQuery (QDiagram b v n m) m # | |

## Queries on diagrams

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

Get the query function associated with a diagram.