Diagrams/Dev/Migrate0.7

From HaskellWiki
< Diagrams‎ | Dev
Revision as of 06:13, 3 August 2013 by Byorgey (talk | contribs) (→‎Trail refactoring: fix mistake: Closed segments, not Open)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page describes breaking API changes between diagrams 0.6 and 0.7, along with explanations of how to migrate to the new 0.7 API.

Diagrams.Coordinates no longer exported by default

For better compatibility with lens, the Diagrams.Coordinates module (which contains, among other things, the (&) operator for constructing literal points and vectors) is no longer exported from Diagrams.Prelude. You must now import Diagrams.Coordinates explicitly in order to make use of it.

CircleFrac becomes Turn

CircleFrac has been renamed Turn (though CircleFrac is retained as a deprecated synonym). This should really only affect you if you were using the CircleFrac constructor; use the new Turn constructor instead.

Trail refactoring

The single biggest breaking change is a big fundamental refactoring in the way that segments and trails work.

  • Segments can now be either "closed" or "open". If you were directly dealing with segments before, you will now want to deal with "open" segments, which involves changing their type from (say) Segment R2 to Segment Closed R2, and wrapping the final offset vector in an OffsetClosed constructor.
  • Paths now contain Located Trails instead of pairs of trails and points. If you were explicitly constructing a Path from such pairs, instead use the at function to construct Located Trails.
  • The PathLike class has become the TrailLike class; the new trailLike function takes a Located Trail as an argument.

For more help with converting, see the user manual or ask for help in the #diagrams IRC channel on freenode.org.