colah/ImplicitCAD — pull request #78 by bgamari (2012-11-30 02:34:29+00:00)
Title: Vector space

This follows the approach taken in Brent Yorgey's diagrams package,
using Conal Elliott's vector-space classes. This allows us to get rid of
the rather unidiomatic and arguably overly-polymorphic
Graphics.Implicit.SaneOperators. Since this has been removed, we can now
begin pulling out the many type annotations strewn about the codebase.

The recently introduced Criterion benchmark confirms that this has no
measurable effect on performance,

Before After
Object 1/STL write 235.7 ± 9.3 ms 236.0 ± 12.8 ms
Object 2/STL write 1.54 ± 0.99 ms 1.44 ± 0.28 us

Note that I make no attempt to enforce any separate between AffineSpaces
and VectorSpaces here. This is work for a later patch.

Additionally, a small performance gain may be had by strictifying and
unpacking the fields of R3 and R2. This, however, would require that a
`data` type be defined and all packing/unpacking of vectors would need
to happen with the appropriate data constructor. Given this is even more
invasive a change than the current patch, this is left as future work.