The common base drawing objects in Wumpus-Basic - a semigroup class, monad classes (TraceM analogue to Writer, DrawingCtxM analogue to Reader), a wrapped Hughes list of primitives.
- class OPlus t where
- oplus :: t -> t -> t
- oconcat :: OPlus t => t -> [t] -> t
- anterior :: OPlus t => t -> t -> t
- superior :: OPlus t => t -> t -> t
- data HAlign
- data VAlign
- type family MonUnit m :: *
- class Monad m => TraceM m where
- class (Applicative m, Monad m) => DrawingCtxM m where
- asksDC :: DrawingCtxM m => (DrawingContext -> a) -> m a
- class Monad m => PointSupplyM m where
- data HPrim u
- hprimToList :: HPrim u -> [Primitive u]
- singleH :: Primitive u -> HPrim u
- data PrimGraphic u
- getPrimGraphic :: PrimGraphic u -> Primitive u
- primGraphic :: Primitive u -> PrimGraphic u
- collectH :: PrimGraphic u -> HPrim u
A Semigroup class.
Horizontal alignment - align to the top, center or bottom.
Vertical alignment - align to the left, center or bottom.
DUnit is always for fully saturated type constructors, so (seemingly) an equivalent type family is needed for monads.
Collect elementary graphics as part of a larger drawing.
TraceM works much like a writer monad.
A monad that supplies points, e.g. a turtle monad.
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.