Skip to content

Instantly share code, notes, and snippets.

@jagregory
Created June 26, 2015 05:39
Show Gist options
  • Select an option

  • Save jagregory/34bbacb51234b2bd3537 to your computer and use it in GitHub Desktop.

Select an option

Save jagregory/34bbacb51234b2bd3537 to your computer and use it in GitHub Desktop.

Revisions

  1. jagregory created this gist Jun 26, 2015.
    11 changes: 11 additions & 0 deletions gistfile1.hs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    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)