Difference between revisions of "Diagrams/Dev/Migrate0.7"

From HaskellWiki
< Diagrams‎ | Dev
Jump to navigation Jump to search
(migration 0.6 -> 0.7)
 
m (→‎Trail refactoring: fix mistake: Closed segments, not Open)
 
Line 13: Line 13:
 
The single biggest breaking change is a big fundamental refactoring in the way that segments and trails work.
 
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) <code>Segment R2</code> to <code>Segment Open R2</code>, and wrapping the final offset vector in an <code>OffsetOpen</code> constructor.
+
* 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) <code>Segment R2</code> to <code>Segment Closed R2</code>, and wrapping the final offset vector in an <code>OffsetClosed</code> constructor.
   
 
* <code>Path</code>s now contain <code>Located Trail</code>s instead of pairs of trails and points. If you were explicitly constructing a <code>Path</code> from such pairs, instead use the <code>at</code> function to construct <code>Located Trail</code>s.
 
* <code>Path</code>s now contain <code>Located Trail</code>s instead of pairs of trails and points. If you were explicitly constructing a <code>Path</code> from such pairs, instead use the <code>at</code> function to construct <code>Located Trail</code>s.

Latest revision as of 06:13, 3 August 2013

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.