Diagrams/Dev/Migrate1.1

From HaskellWiki
< Diagrams‎ | Dev
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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