Diagrams/Dev/Migrate1.1

From HaskellWiki
< Diagrams‎ | Dev
Revision as of 15:05, 17 May 2014 by Bergey (talk | contribs) (link to user manual angles section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Angles are now represented by a single type

The types Turn, Rad, and Deg have been subsumed by the new type Angle. The old type class Angle is no longer needed. See the user manual for more exposition.

Code which constructed angles like

(0.5 :: Turn)

can be written instead as

(0.5 @@ turn)

The new functions rad and deg can be used similarly. All three have type Iso from lens.

Extracting a measurement with particular units, which used to look like

Rad theta = convertAngle a

can be written

theta = a ^. rad

The function convertAngle is no longer needed, and has been removed. Finally, where the Angle type class was used as a constraint,

Angle a => a -> b

becomes

Angle -> b