Portability | GHC |
---|---|

Stability | highly unstable |

Maintainer | stephen.tetley@gmail.com |

Two *warpped* versions of the Primitive type from Wumpus-Core.

- data HPrim u
- hprimToList :: HPrim u -> [Primitive u]
- singleH :: Primitive u -> HPrim u
- class TraceM m where
- data PrimGraphic u
- getPrimGraphic :: PrimGraphic u -> Primitive u
- primGraphic :: Primitive u -> PrimGraphic u
- metamorphPrim :: (Primitive u -> Primitive u) -> PrimGraphic u -> PrimGraphic u
- collectH :: PrimGraphic u -> HPrim u

# Primitives

Graphics objects, even simple ones (line, arrow, dot) might
need more than one primitive (path or text label) for their
construction. Hence, the primary representation that all the
others are built upon must support *concatenation* of
primitives.

Wumpus-Core has a type Picture - made from one or more Primitives - but Pictures include support for affine frames. For drawing many simple graphics (dots, connector lines...) that do not need individual affine transformations this is a penalty. A list of Primitives is therefore more suitable representation, and a Hughes list which supports efficient concatenation is wise.

hprimToList :: HPrim u -> [Primitive u]Source

# Collect primitives (writer monad)

Collect elementary graphics as part of a larger drawing.

TraceM works much like a writer monad.

data PrimGraphic u Source

Eq u => Eq (PrimGraphic u) | |

Show u => Show (PrimGraphic u) | |

(Real u, Floating u) => Rotate (PrimGraphic u) | |

(Real u, Floating u) => RotateAbout (PrimGraphic u) | |

Num u => Scale (PrimGraphic u) | |

Num u => Translate (PrimGraphic u) | |

OPlus (PrimGraphic u) |

getPrimGraphic :: PrimGraphic u -> Primitive uSource

primGraphic :: Primitive u -> PrimGraphic uSource

metamorphPrim :: (Primitive u -> Primitive u) -> PrimGraphic u -> PrimGraphic uSource

collectH :: PrimGraphic u -> HPrim uSource