module Data.Factual.Shared.Geo
(
Lat
, Long
, Radius
, Geo(..)
, geoPair
) where
type Lat = Double
type Long = Double
type Radius = Double
data Geo = Circle Lat Long Radius
| Point Lat Long
deriving Eq
instance Show Geo where
show (Circle lat long radius) = "{\"$circle\":{\"$center\":["
++ (show lat)
++ ", "
++ (show long)
++ "],\"$meters\":"
++ (show radius)
++ "}}"
show (Point lat long) = "{\"$point\":["
++ (show lat)
++ ","
++ (show long)
++ "]}"
geoPair :: Maybe Geo -> (String, String)
geoPair (Just g) = ("geo", show g)
geoPair Nothing = ("geo", "")