module Data.Geo.Coord(
Coord,
(|.|),
(!.!),
(|..|),
radians'
) where
import Data.Geo.Latitude
import Data.Geo.Longitude
import Data.Geo.Radians
import Data.Geo.Accessor.Lat
import Data.Geo.Accessor.Lon
import Data.Geo.Accessor.Value
import Control.Applicative
import Control.Arrow
data Coord = Coord Latitude Longitude
deriving Eq
instance Lat Coord where
lat (Coord x _) = x
instance Lon Coord where
lon (Coord _ x) = x
instance Show Coord where
show = show . (value . lat &&& value . lon)
(|.|) :: Latitude -> Longitude -> Coord
(|.|) = Coord
infixl 8 |.|
(!.!) :: Double -> Double -> Coord
(!.!) x y = latitude x |.| longitude y
infixl 8 !.!
(|..|) :: Double -> Double -> Coord
(|..|) lat' lon' = fromRadians lat' |.| fromRadians lon'
infixl 8 |..|
radians' :: Coord -> (Double, Double)
radians' = radians <$> lat <*> lon