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

Stability | highly unstable |

Maintainer | stephen.tetley@gmail.com |

The elementary base types and classes.

- class OPlus t where
- oplus :: t -> t -> t

- oconcat :: OPlus t => t -> [t] -> t
- class Bimap f where
- replaceL :: Bimap f => p -> f a b -> f p b
- replaceR :: Bimap f => q -> f a b -> f a q
- data HAlign
- data VAlign
- type AdvanceVec u = Vec2 u
- advanceH :: AdvanceVec u -> u
- advanceV :: AdvanceVec u -> u
- type PointDisplace u = Point2 u -> Point2 u
- displace :: Num u => u -> u -> PointDisplace u
- displaceVec :: Num u => Vec2 u -> PointDisplace u
- displaceH :: Num u => u -> PointDisplace u
- displaceV :: Num u => u -> PointDisplace u
- type ThetaPointDisplace u = Radian -> PointDisplace u
- displaceParallel :: Floating u => u -> ThetaPointDisplace u
- displacePerpendicular :: Floating u => u -> ThetaPointDisplace u
- type family MonUnit m :: *
- class Monad m => PointSupplyM m where

# A semigroup class

A Semigroup class.

The perhaps unusual name is the TeX name for the circled plus glyph. It would be nice if there was a semigroup class in the Haskell Base libraries...

# A bifunctor class

A Bifunctor class.

Again, it would be nice if there was a Bifunctor class in the Haskell Base libraries...

# Alignment

Horizontal alignment - align to the top, center or bottom.

Vertical alignment - align to the left, center or bottom.

# Advance vector

type AdvanceVec u = Vec2 uSource

Advance vectors provide an idiom for drawing consecutive graphics. PostScript uses them to draw left-to-right text - each character has an advance vector for the width and as characters are drawn they successively displace the start point for the next character with their advance vector.

Type alias for Vec2.

advanceH :: AdvanceVec u -> uSource

Extract the horizontal component of an advance vector.

For left-to-right latin text, the vertical component of an advance vector is expected to be 0. Ingoring it seems permissible when drawing text.

advanceV :: AdvanceVec u -> uSource

Extract the verticall component of an advance vector.

# Moving points

type PointDisplace u = Point2 u -> Point2 uSource

`PointDisplace`

is a type representing functions
`from Point to Point`

.

It is especially useful for building composite graphics where one part of the graphic is drawn from a different start point to the other part.

displace :: Num u => u -> u -> PointDisplace uSource

`displace`

: ` x -> y -> PointDisplace `

Build a combinator to move `Points`

by the supplied `x`

and
`y`

distances.

displaceVec :: Num u => Vec2 u -> PointDisplace uSource

displaceH :: Num u => u -> PointDisplace uSource

`displaceH`

: ` x -> PointDisplace `

Build a combinator to move `Points`

by horizontally the
supplied `x`

distance.

displaceV :: Num u => u -> PointDisplace uSource

`displaceV`

: ` y -> PointDisplace `

Build a combinator to move `Points`

vertically by the supplied
`y`

distance.

type ThetaPointDisplace u = Radian -> PointDisplace uSource

`ThetaPointDisplace`

is a type representing functions
`from Radian * Point to Point`

.

It is useful for building arrowheads which are constructed with an implicit angle representing the direction of the line at the arrow tip.

displaceParallel :: Floating u => u -> ThetaPointDisplace uSource

`displaceParallel`

: ` dist -> ThetaPointDisplace `

Build a combinator to move `Points`

in parallel to the
direction of the implicit angle by the supplied distance
`dist`

.

displacePerpendicular :: Floating u => u -> ThetaPointDisplace uSource

`displaceParallel`

: ` dist -> ThetaPointDisplace `

Build a combinator to move `Points`

perpendicular to the
direction of the implicit angle by the supplied distance
`dist`

.

# Monadic drawing

type family MonUnit m :: *Source

DUnit is always for fully saturated type constructors, so (seemingly) an equivalent type family is needed for monads.

class Monad m => PointSupplyM m whereSource

A monad that supplies points, e.g. a turtle monad.

** WARNING ** - the idea behind this class is somewhat half-baked. It may be revised or even dropped in subsequent versions of Wumpus-Basic.

(u ~ MonUnit m, Monad m, Num u) => PointSupplyM (TurtleT u m) |