packages feed

radian 0.0.5 → 0.0.6

raw patch · 3 files changed

+37/−8 lines, 3 filesdep +profunctors

Dependencies added: profunctors

Files

changelog view
@@ -1,3 +1,7 @@+0.0.6++* Remove dependency on lens.+ 0.0.5  * Fix documentation.
radian.cabal view
@@ -1,5 +1,5 @@ name:               radian-version:            0.0.5+version:            0.0.6 license:            BSD3 license-file:       LICENCE author:             Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ>@@ -30,7 +30,7 @@    build-depends:                       base < 5 && >= 3-                    , lens >= 4.0+                    , profunctors >= 3.1.1    ghc-options:                     -Wall@@ -61,6 +61,7 @@                     , directory >= 1.1                     , QuickCheck >= 2.0                     , template-haskell >= 2.8+                    , lens >= 4.0    ghc-options:                     -Wall
src/Data/Radian.hs view
@@ -1,12 +1,13 @@ {-# LANGUAGE NoImplicitPrelude #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE RankNTypes #-}  module Data.Radian(   toRadians , fromRadians ) where -import Control.Lens(Iso, iso, from)+import Data.Functor(Functor(fmap))+import Data.Profunctor(Profunctor(dimap)) import Prelude(Num((*)), Fractional((/)), Floating, pi)  -- $setup@@ -39,9 +40,9 @@   (Floating a, Floating b) =>   Iso a b a b toRadians =-  iso-    (\a -> a / pi * 180)-    (\a -> a / 180 * pi)   +  dimap+    to+    (fmap fr)  -- | An isomorphism between degrees and radians. --@@ -60,4 +61,27 @@   (Floating a, Floating b) =>   Iso a b a b fromRadians =-  from toRadians+  dimap+    fr+    (fmap to)++----++to ::+  Floating a =>+  a+  -> a+to a =+  a / pi * 180++fr ::+  Floating a =>+  a+  -> a+fr a =+  a / 180 * pi++type Iso s t a b =+  forall p f.+  (Profunctor p, Functor f) =>+  p a (f b) -> p s (f t)