Safe Haskell | None |
---|---|
Language | Haskell2010 |
A module for creating collections of heterogenous shape types with uniform styling and rendering them as SVG elements.
Synopsis
- data ShapeLike
- pattern MkShape :: a -> ShapeLike
- data Layer
- shapes :: Layer -> [ShapeLike]
- style :: Layer -> Maybe StyleAttrs
- mkLayer :: (Show a, SvgShape a, Transformable a) => String -> [a] -> Layer
- mkLayerWithStyle :: (Show a, SvgShape a, Transformable a) => String -> [a] -> StyleAttrs -> Layer
- pack :: (Show a, SvgShape a, Transformable a) => a -> ShapeLike
- (+:) :: (Show a, SvgShape a, Transformable a) => a -> Layer -> Layer
Documentation
We use an existential type to wrap anything that meets our defintition of a shape. That is to say it can be shown, can be transformed according to methods in the Transformable typeclass, and can be converted to an SVG element. This includes arcs, circles, lines, and rectangles. Heterogenous shapes can all be placed in a single list and transformed via this type.
A layer is just a sequence of shape-like things with a name and style
mkLayer :: (Show a, SvgShape a, Transformable a) => String -> [a] -> Layer Source #
Layer constructor from a list of shapes: without style
mkLayerWithStyle :: (Show a, SvgShape a, Transformable a) => String -> [a] -> StyleAttrs -> Layer Source #
Layer constructor from a list of shapes: with style