module Data.Geo.Radians(
Radians,
fromRadians,
toRadians,
radians
) where
import Data.Geo.Latitude
import Data.Geo.Longitude
import Data.Geo.Bearing
import Data.Geo.Accessor.Value
import Control.Arrow
class Radians a where
toRadians :: a -> Double
fromRadians :: Double -> a
instance Radians Double where
toRadians n = n * pi / 180
fromRadians n = n * 180 / pi
instance Radians Latitude where
toRadians = toRadians . value
fromRadians = latitude . fromRadians
instance Radians Longitude where
toRadians = toRadians . value
fromRadians = longitude . fromRadians
instance Radians Bearing where
toRadians = toRadians . value
fromRadians = bearing . fromRadians
radians :: (Radians a, Radians b) => a -> b -> (Double, Double)
radians = curry (toRadians *** toRadians)