Ticket #13 (new task)
Opened 4 years ago
More combinators in D.Combinators
|Reported by:||byorgey||Owned by:|
Fill out the Combinators module with lots of combinators for putting diagrams together. Use the original diagrams library for inspiration. However, I think we should use a record-passing style where each function takes a record of arguments, which has a default instance implemented via a Data.Default instance. Then users get to do named argument passing by passing the default record and overriding selected arguments.
An (incomplete) list of the sort of combinators we will need:
* union = mconcat (put a bunch of diagrams on top of one another) * cat (lay out a bunch of diagrams next to each other)
this one should have lots of arguments in its record, e.g. direction along which to lay out the diagrams; separation between diagrams; alignment; distribution method (see e.g. inkscape's align/distribute panel for inspiration)
It may be worth predefining a few aliases for cat with one or two arguments filled in, e.g. hcat and vcat for the common cases of laying out diagrams horizontally or vertically, and so on.
* along (lay out diagrams along a path)
not sure of the right API for this, but there might be options for spacing, distribution, that sort of thing. In fact, 'cat' could (and probably should) be implemented in terms of 'along', by first creating an appropriate (straight) path and then calling 'along'. Perhaps 'cat' and 'along' really ought to be unified into one primitive.