module Data.Geo.GPX.LongitudeType(
LongitudeType,
longitudeType
) where
import Data.Geo.GPX.Accessor.Value
import Data.Fixed
import Text.XML.HXT.Arrow
newtype LongitudeType = LongitudeType Double
deriving (Eq, Ord, Enum, Num, Fractional, Floating, Real, RealFrac, RealFloat)
longitudeType :: Double
-> LongitudeType
longitudeType n = LongitudeType ((n + 180) `mod'` 360 180)
instance XmlPickler LongitudeType where
xpickle = xpWrap (longitudeType, \(LongitudeType n) -> n) xpPrim
instance Show LongitudeType where
show (LongitudeType n) = show n
instance Value LongitudeType Double where
value (LongitudeType x) = x
setValue x (LongitudeType _) = longitudeType x