Skip to content

Instantly share code, notes, and snippets.

@jagregory
Created June 26, 2015 05:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
newtype
newtype Degree = Degree Float
newtype Radian = Radian Float
toRad :: Degree -> Radian
toRad (Degree deg) = Radian (deg * pi / 180)
-- this works
new1 = toRad (Degree 90.0)
-- this doesn't work
-- new2 = toRad (Radian 1.25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment