packages feed

coordinate 0.0.7 → 0.0.8

raw patch · 3 files changed

+21/−5 lines, 3 files

Files

coordinate.cabal view
@@ -1,5 +1,5 @@ name:               coordinate-version:            0.0.7+version:            0.0.8 license:            BSD3 license-File:       etc/LICENCE author:             Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ>
src/Data/Geo/Coordinate/Latitude.hs view
@@ -1,10 +1,10 @@-module Data.Geo.Coordinate.Latitude(+module Data.Geo.Coordinate.Latitude {-(   Latitude , HasLatitude(..) , dmsLatitude , fracLatitude , radianLatitude-) where+) -} where  import Prelude(Double, Eq, Show, Ord(..), Num(..), Floating(..), Fractional(..), Bool(..), Monad(..), id, (&&), (.), properFraction, fromIntegral) import Control.Lens(Iso', Prism', Lens', iso, prism', lens, (#), (^?))@@ -69,6 +69,12 @@ -- >>> (-7.12) ^? fracLatitude -- Just (Latitude (DegreesLatitude (-7)) (Minutes 7) (Seconds 12.0000)) --+-- >>> fmap (fracLatitude #) (7.12 ^? fracLatitude)+-- Just 7.12+--+-- >>> fmap (fracLatitude #) ((-7.12) ^? fracLatitude)+-- Just (-7.12)+-- -- >>> 90 ^? fracLatitude -- Nothing --@@ -93,7 +99,9 @@   Prism' Double Latitude fracLatitude =   prism' (\(Latitude d m s) ->-    fromIntegral (nDegreesLatitude # d) + (fromIntegral (nMinutes # m) / 60) + (nSeconds # s) / 3600)+    let p = fromIntegral (nDegreesLatitude # d)+        q = (fromIntegral (nMinutes # m) / 60) + (nSeconds # s) / 3600+    in (if p < 0 then (-) else (+)) p q)     (\x -> let (d, z) = properFraction x                (m, s) = properFraction ((z :: Double) * 60)            in do d' <- d ^? nDegreesLatitude
src/Data/Geo/Coordinate/Longitude.hs view
@@ -69,6 +69,12 @@ -- >>> (-7.12) ^? fracLongitude -- Just (Longitude (DegreesLongitude (-7)) (Minutes 7) (Seconds 12.0000)) --+-- >>> fmap (fracLongitude #) (7.12 ^? fracLongitude)+-- Just 7.12+--+-- >>> fmap (fracLongitude #) ((-7.12) ^? fracLongitude)+-- Just (-7.12)+-- -- >>> 180 ^? fracLongitude -- Nothing --@@ -93,7 +99,9 @@   Prism' Double Longitude fracLongitude =   prism' (\(Longitude d m s) ->-    fromIntegral (nDegreesLongitude # d) + (fromIntegral (nMinutes # m) / 60) + (nSeconds # s) / 3600)+    let p = fromIntegral (nDegreesLongitude # d)+        q = (fromIntegral (nMinutes # m) / 60) + (nSeconds # s) / 3600+    in (if p < 0 then (-) else (+)) p q)     (\x -> let (d, z) = properFraction x                (m, s) = properFraction ((z :: Double) * 60)            in do d' <- d ^? nDegreesLongitude