Diagrams/Dev/Migrate1.1
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.
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