module Data.Geo.OSM.Node
(
Node
, node
) where
import Text.XML.HXT.Arrow.Pickle
import Data.Geo.OSM.NWRCommon
import Data.Geo.OSM.Tag
import Data.Geo.OSM.Lens.LatL
import Data.Geo.OSM.Lens.LonL
import Data.Geo.OSM.Lens.IdL
import Data.Geo.OSM.Lens.TagsL
import Data.Geo.OSM.Lens.ChangesetL
import Data.Geo.OSM.Lens.VisibleL
import Data.Geo.OSM.Lens.UserL
import Data.Geo.OSM.Lens.UidL
import Data.Geo.OSM.Lens.TimestampL
import Data.Lens.Common
import Control.Comonad.Trans.Store
import Control.Category
import Prelude hiding ((.))
data Node =
Node String String NWRCommon
deriving Eq
instance XmlPickler Node where
xpickle =
xpElem "node" (xpWrap (\(lat', lon', nwr') -> Node lat' lon' nwr', \(Node lat' lon' nwr') -> (lat', lon', nwr'))
(xpTriple (xpAttr "lat" xpText) (xpAttr "lon" xpText) xpickle))
instance Show Node where
show =
showPickled []
instance LatL Node where
latL =
Lens $ \(Node lat lon common) -> store (\lat -> Node lat lon common) lat
instance LonL Node where
lonL =
Lens $ \(Node lat lon common) -> store (\lon -> Node lat lon common) lon
commonL ::
Lens Node NWRCommon
commonL =
Lens (\(Node lat lon common) -> store (\common -> Node lat lon common) common)
instance IdL Node where
idL =
idL . commonL
instance TagsL Node where
tagsL =
tagsL . commonL
instance ChangesetL Node where
changesetL =
changesetL . commonL
instance VisibleL Node where
visibleL =
visibleL . commonL
instance UserL Node (Maybe String) where
userL =
userL . commonL
instance UidL Node where
uidL =
uidL . commonL
instance TimestampL Node (Maybe String) where
timestampL =
timestampL . commonL
node ::
String
-> String
-> String
-> [Tag]
-> Maybe String
-> Bool
-> (Maybe String, Maybe String)
-> Maybe String
-> Node
node =
flip flip nwrCommon . (((.) . (.) . (.) . (.) . (.) . (.)) .) . Node