OSM-0.6.4/0000755000000000000000000000000011710770016010345 5ustar0000000000000000OSM-0.6.4/OSM.cabal0000644000000000000000000001014611710770016011771 0ustar0000000000000000Name: OSM Version: 0.6.4 License: BSD3 License-File: LICENSE Synopsis: Parse OpenStreetMap files Description: Parse OpenStreetMap http:\/\/osm.org/ files using HXT into data structures. The Data.Geo.OSM module is the core module that exports all others. Homepage: https://github.com/tonymorris/geo-osm Category: Utils Author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ>, Thomas DuBuisson Maintainer: Tony Morris, Thomas DuBuisson Copyright: 2009 -- 2012 Tony Morris, Thomas DuBuisson Build-Type: Simple Cabal-Version: >= 1.6 Source-Repository head Type: git Location: git@github.com:tonymorris/geo-osm.git Flag small_base Description: Choose the new, split-up base package. Library Build-Depends: base < 5 && >= 3 , hxt >= 9 , containers , data-lens , comonad-transformers , newtype GHC-Options: -Wall -fno-warn-name-shadowing Hs-Source-Dirs: src Exposed-Modules: Data.Geo.OSM Data.Geo.OSM.Api Data.Geo.OSM.Area Data.Geo.OSM.Bound Data.Geo.OSM.BoundOption Data.Geo.OSM.Bounds Data.Geo.OSM.Changeset Data.Geo.OSM.Children Data.Geo.OSM.GpxFile Data.Geo.OSM.Home Data.Geo.OSM.Lens Data.Geo.OSM.Member Data.Geo.OSM.MemberType Data.Geo.OSM.Nd Data.Geo.OSM.Node Data.Geo.OSM.NodeWayRelation Data.Geo.OSM.NWRCommon Data.Geo.OSM.OSM Data.Geo.OSM.Preferences Data.Geo.OSM.Relation Data.Geo.OSM.Tag Data.Geo.OSM.Tracepoints Data.Geo.OSM.User Data.Geo.OSM.Version Data.Geo.OSM.Way Data.Geo.OSM.Waynodes Data.Geo.OSM.Lens.AccountCreatedL Data.Geo.OSM.Lens.AreaL Data.Geo.OSM.Lens.BoundsL Data.Geo.OSM.Lens.BoxL Data.Geo.OSM.Lens.ChangesetL Data.Geo.OSM.Lens.ChildrenL Data.Geo.OSM.Lens.DisplayNameL Data.Geo.OSM.Lens.GeneratorL Data.Geo.OSM.Lens.HomeL Data.Geo.OSM.Lens.IdL Data.Geo.OSM.Lens.KL Data.Geo.OSM.Lens.LatL Data.Geo.OSM.Lens.LonL Data.Geo.OSM.Lens.MaximumL Data.Geo.OSM.Lens.MaxlatL Data.Geo.OSM.Lens.MaxlonL Data.Geo.OSM.Lens.MemberL Data.Geo.OSM.Lens.MinimumL Data.Geo.OSM.Lens.MinlatL Data.Geo.OSM.Lens.MinlonL Data.Geo.OSM.Lens.NameL Data.Geo.OSM.Lens.NdL Data.Geo.OSM.Lens.OriginL Data.Geo.OSM.Lens.PendingL Data.Geo.OSM.Lens.PerPageL Data.Geo.OSM.Lens.PublicL Data.Geo.OSM.Lens.RefL Data.Geo.OSM.Lens.RoleL Data.Geo.OSM.Lens.TagsL Data.Geo.OSM.Lens.TimestampL Data.Geo.OSM.Lens.TracepointsL Data.Geo.OSM.Lens.TypeL Data.Geo.OSM.Lens.UidL Data.Geo.OSM.Lens.UserL Data.Geo.OSM.Lens.VersionL Data.Geo.OSM.Lens.VisibleL Data.Geo.OSM.Lens.VL Data.Geo.OSM.Lens.WaynodesL Data.Geo.OSM.Lens.ZoomL OSM-0.6.4/Setup.hs0000644000000000000000000000005711710770016012003 0ustar0000000000000000import Distribution.Simple main = defaultMain OSM-0.6.4/LICENSE0000644000000000000000000000267011710770016011357 0ustar0000000000000000Copyright 2011 Tony Morris All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the author nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OSM-0.6.4/src/0000755000000000000000000000000011710770015011133 5ustar0000000000000000OSM-0.6.4/src/Data/0000755000000000000000000000000011710770015012004 5ustar0000000000000000OSM-0.6.4/src/Data/Geo/0000755000000000000000000000000011710770015012516 5ustar0000000000000000OSM-0.6.4/src/Data/Geo/OSM.hs0000644000000000000000000000260711710770015013515 0ustar0000000000000000-- | OpenStreetMap API v0.6 DTD module Data.Geo.OSM ( module Data.Geo.OSM.Api , module Data.Geo.OSM.Area , module Data.Geo.OSM.Bound , module Data.Geo.OSM.Bounds , module Data.Geo.OSM.Changeset , module Data.Geo.OSM.GpxFile , module Data.Geo.OSM.Home , module Data.Geo.OSM.Member , module Data.Geo.OSM.MemberType , module Data.Geo.OSM.Nd , module Data.Geo.OSM.Node , module Data.Geo.OSM.NodeWayRelation , module Data.Geo.OSM.OSM , module Data.Geo.OSM.Children , module Data.Geo.OSM.Preferences , module Data.Geo.OSM.Relation , module Data.Geo.OSM.Tag , module Data.Geo.OSM.Tracepoints , module Data.Geo.OSM.User , module Data.Geo.OSM.Version , module Data.Geo.OSM.Way , module Data.Geo.OSM.Waynodes , module Data.Geo.OSM.Lens ) where import Data.Geo.OSM.Api import Data.Geo.OSM.Area import Data.Geo.OSM.Bound import Data.Geo.OSM.Bounds import Data.Geo.OSM.Changeset import Data.Geo.OSM.GpxFile import Data.Geo.OSM.Home import Data.Geo.OSM.Member import Data.Geo.OSM.MemberType import Data.Geo.OSM.Nd import Data.Geo.OSM.Node import Data.Geo.OSM.NodeWayRelation import Data.Geo.OSM.OSM import Data.Geo.OSM.Children import Data.Geo.OSM.Preferences import Data.Geo.OSM.Relation import Data.Geo.OSM.Tag import Data.Geo.OSM.Tracepoints import Data.Geo.OSM.User import Data.Geo.OSM.Version import Data.Geo.OSM.Way import Data.Geo.OSM.Waynodes import Data.Geo.OSM.Lens OSM-0.6.4/src/Data/Geo/OSM/0000755000000000000000000000000011710770016013155 5ustar0000000000000000OSM-0.6.4/src/Data/Geo/OSM/Waynodes.hs0000644000000000000000000000172011710770016015302 0ustar0000000000000000{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses #-} -- | The @waynodes@ element of a OSM file. module Data.Geo.OSM.Waynodes ( Waynodes , waynodes ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Lens.MaximumL import Data.Lens.Common import Control.Comonad.Trans.Store import Control.Newtype -- | The @waynodes@ element of a OSM file. newtype Waynodes = Waynodes String deriving Eq -- | Constructs a @waynodes@ with maximum. waynodes :: String -- ^ The @maximum@ attribute. -> Waynodes waynodes = Waynodes instance XmlPickler Waynodes where xpickle = xpElem "waynodes" (xpWrap (waynodes, \(Waynodes r) -> r) (xpAttr "maximum" xpText)) instance Show Waynodes where show = showPickled [] instance MaximumL Waynodes where maximumL = Lens $ \(Waynodes maximum) -> store (\maximum -> Waynodes maximum) maximum instance Newtype Waynodes String where pack = Waynodes unpack (Waynodes x) = x OSM-0.6.4/src/Data/Geo/OSM/Bounds.hs0000644000000000000000000000417011710770015014744 0ustar0000000000000000-- | The @bounds@ element of a OSM file. module Data.Geo.OSM.Bounds ( Bounds , bounds ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Lens.MinlatL import Data.Geo.OSM.Lens.MaxlatL import Data.Geo.OSM.Lens.MinlonL import Data.Geo.OSM.Lens.MaxlonL import Data.Geo.OSM.Lens.OriginL import Data.Lens.Common import Control.Comonad.Trans.Store -- | The @bounds@ element of a OSM file. data Bounds = Bounds String String String String (Maybe String) deriving Eq instance XmlPickler Bounds where xpickle = xpElem "bounds" (xpWrap (\(minlat', minlon', maxlat', maxlon', origin') -> bounds minlat' minlon' maxlat' maxlon' origin', \(Bounds minlat' minlon' maxlat' maxlon' origin') -> (minlat', minlon', maxlat', maxlon', origin')) (xp5Tuple (xpAttr "minlat" xpText) (xpAttr "minlon" xpText) (xpAttr "maxlat" xpText) (xpAttr "maxlon" xpText) (xpOption (xpAttr "origin" xpText)))) instance Show Bounds where show = showPickled [] instance MinlatL Bounds where minlatL = Lens $ \(Bounds minlat minlon maxlat maxlon origin) -> store (\minlat -> Bounds minlat minlon maxlat maxlon origin) minlat instance MinlonL Bounds where minlonL = Lens $ \(Bounds minlat minlon maxlat maxlon origin) -> store (\minlon -> Bounds minlat minlon maxlat maxlon origin) minlon instance MaxlatL Bounds where maxlatL = Lens $ \(Bounds minlat minlon maxlat maxlon origin) -> store (\maxlat -> Bounds minlat minlon maxlat maxlon origin) maxlat instance MaxlonL Bounds where maxlonL = Lens $ \(Bounds minlat minlon maxlat maxlon origin) -> store (\maxlon -> Bounds minlat minlon maxlat maxlon origin) maxlon instance OriginL Bounds where originL = Lens $ \(Bounds minlat minlon maxlat maxlon origin) -> store (\origin -> Bounds minlat minlon maxlat maxlon origin) origin -- | Constructs a bounds with a minlat, minlon, maxlat, maxlon and origin attributes. bounds :: String -- ^ The @minlat@ attribute. -> String -- ^ The @minlon@ attribute. -> String -- ^ The @maxlat@ attribute. -> String -- ^ The @maxlon@ attribute. -> Maybe String -- ^ The @origin@ attribute. -> Bounds bounds = Bounds OSM-0.6.4/src/Data/Geo/OSM/Changeset.hs0000644000000000000000000000171611710770015015416 0ustar0000000000000000{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} -- | The @changeset@ element of a OSM file. module Data.Geo.OSM.Changeset ( Changeset , changeset ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Tag import Data.Geo.OSM.Lens.TagsL import Data.Lens.Common import Control.Comonad.Trans.Store import Control.Newtype -- | The @changeset@ element of a OSM file. newtype Changeset = Changeset [Tag] deriving Eq -- | Constructs a @changeset@ with tags. changeset :: [Tag] -- ^ The list of tags (@tag@ elements). -> Changeset changeset = Changeset instance XmlPickler Changeset where xpickle = xpElem "changeset" (xpWrap (changeset, \(Changeset r) -> r) (xpList xpickle)) instance Show Changeset where show = showPickled [] instance TagsL Changeset where tagsL = Lens $ \(Changeset tags) -> store (\tags -> Changeset tags) tags instance Newtype Changeset [Tag] where pack = Changeset unpack (Changeset x) = x OSM-0.6.4/src/Data/Geo/OSM/Version.hs0000644000000000000000000000205411710770016015137 0ustar0000000000000000-- | The @version@ element of a OSM file. module Data.Geo.OSM.Version ( Version , version ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Lens.MinimumL import Data.Geo.OSM.Lens.MaximumL import Data.Lens.Common import Control.Comonad.Trans.Store -- | The @version@ element of a OSM file. data Version = Version String String deriving Eq -- | Constructs a @version@ with minimum and maximum. version :: String -- ^ The @minimum@ attribute. -> String -- ^ The @maximum@ attribute. -> Version version = Version instance XmlPickler Version where xpickle = xpElem "version" (xpWrap (uncurry version, \(Version min' max') -> (min', max')) (xpPair (xpAttr "minimum" xpText) (xpAttr "maximum" xpText))) instance Show Version where show = showPickled [] instance MinimumL Version where minimumL = Lens $ \(Version minimum maximum) -> store (\minimum -> Version minimum maximum) minimum instance MaximumL Version where maximumL = Lens $ \(Version minimum maximum) -> store (\maximum -> Version minimum maximum) maximum OSM-0.6.4/src/Data/Geo/OSM/BoundOption.hs0000644000000000000000000000134411710770015015752 0ustar0000000000000000-- | A bound-option is either a @Bound@, @Bounds@ or empty. module Data.Geo.OSM.BoundOption ( BoundOption , foldBoundOption , optionBound , optionBounds , optionEmptyBound ) where import Data.Geo.OSM.Bound import Data.Geo.OSM.Bounds data BoundOption = OptionBound Bound | OptionBounds Bounds | Empty deriving Eq foldBoundOption :: (Bound -> x) -> (Bounds -> x) -> x -> BoundOption -> x foldBoundOption f _ _ (OptionBound b) = f b foldBoundOption _ f _ (OptionBounds b) = f b foldBoundOption _ _ f Empty = f optionBound :: Bound -> BoundOption optionBound = OptionBound optionBounds :: Bounds -> BoundOption optionBounds = OptionBounds optionEmptyBound :: BoundOption optionEmptyBound = Empty OSM-0.6.4/src/Data/Geo/OSM/Preferences.hs0000644000000000000000000000177411710770015015762 0ustar0000000000000000{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} -- | The @preferences@ element of a OSM file. module Data.Geo.OSM.Preferences ( Preferences , preferences ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Tag import Data.Geo.OSM.Lens.TagsL import Data.Lens.Common import Control.Comonad.Trans.Store import Control.Newtype -- | The @preferences@ element of a OSM file. newtype Preferences = Preferences [Tag] deriving Eq -- | Constructs a @preferences@ with tags. preferences :: [Tag] -- ^ The list of tags (@tag@ elements). -> Preferences preferences = Preferences instance XmlPickler Preferences where xpickle = xpElem "preferences" (xpWrap (preferences, \(Preferences r) -> r) (xpList xpickle)) instance Show Preferences where show = showPickled [] instance TagsL Preferences where tagsL = Lens $ \(Preferences tags) -> store (\tags -> Preferences tags) tags instance Newtype Preferences [Tag] where pack = Preferences unpack (Preferences x) = x OSM-0.6.4/src/Data/Geo/OSM/Way.hs0000644000000000000000000000411111710770016014246 0ustar0000000000000000{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} -- | The @way@ element of a OSM file. module Data.Geo.OSM.Way ( Way , way ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Nd import Data.Geo.OSM.NWRCommon import Data.Geo.OSM.Tag import Data.Geo.OSM.Lens.NdL 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 ((.)) -- | The @way@ element of a OSM file. data Way = Way [Nd] NWRCommon deriving Eq instance XmlPickler Way where xpickle = xpElem "way" (xpWrap (uncurry Way, \(Way n r) -> (n, r)) (xpPair (xpList xpickle) xpickle)) instance Show Way where show = showPickled [] instance NdL Way where ndL = Lens $ \(Way nds common) -> store (\nds -> Way nds common) nds -- not exported commonL :: Lens Way NWRCommon commonL = Lens (\(Way nds common) -> store (\common -> Way nds common) common) instance IdL Way where idL = idL . commonL instance TagsL Way where tagsL = tagsL . commonL instance ChangesetL Way where changesetL = changesetL . commonL instance VisibleL Way where visibleL = visibleL . commonL instance UserL Way (Maybe String) where userL = userL . commonL instance UidL Way where uidL = uidL . commonL instance TimestampL Way (Maybe String) where timestampL = timestampL . commonL -- | Constructs a way with a list of nds, id, list of tags, changeset, visible, user&uid and timestamp. way :: [Nd] -- ^ The list of nds (@nd@ elements). -> String -- ^ The @id@ attribute. -> [Tag] -- ^ The list of tags (@tag@ elements). -> Maybe String -- ^ The @changeset@ attribute. -> Bool -- ^ The @visible@ attribute. -> (Maybe String, Maybe String) -- ^ The @user@ and @uid@ attributes. -> Maybe String -- ^ The @timestamp@ attribute. -> Way way = (. nwrCommon) . (.) . (.) . (.) . (.) . (.) . Way OSM-0.6.4/src/Data/Geo/OSM/User.hs0000644000000000000000000000274411710770016014436 0ustar0000000000000000-- | The @user@ element of a OSM file. module Data.Geo.OSM.User ( User , user ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Home import Data.Geo.OSM.Lens.HomeL import Data.Geo.OSM.Lens.DisplayNameL import Data.Geo.OSM.Lens.AccountCreatedL import Data.Lens.Common import Control.Comonad.Trans.Store -- | The @user@ element of a OSM file. data User = User (Maybe Home) String String deriving Eq -- | Constructs a @user@ with an optional home, display_name and account_created. user :: Maybe Home -- ^ The @home@ element. -> String -- ^ The @display_name@ attribute. -> String -- ^ The @account_created@ attribute. -> User user = User instance XmlPickler User where xpickle = xpElem "user" (xpWrap (\(home', dn', ac') -> user home' dn' ac', \(User home' dn' ac') -> (home', dn', ac')) (xpTriple (xpOption (xpElem "home" xpickle)) (xpAttr "display_name" xpText) (xpAttr "account_created" xpText))) instance Show User where show = showPickled [] instance HomeL User where homeL = Lens $ \(User home displayName accountCreated) -> store (\home -> User home displayName accountCreated) home instance DisplayNameL User where displayNameL = Lens $ \(User home displayName accountCreated) -> store (\displayName -> User home displayName accountCreated) displayName instance AccountCreatedL User where accountCreatedL = Lens $ \(User home displayName accountCreated) -> store (\accountCreated -> User home displayName accountCreated) accountCreated OSM-0.6.4/src/Data/Geo/OSM/Lens.hs0000644000000000000000000000515011710770015014412 0ustar0000000000000000module Data.Geo.OSM.Lens( module Data.Geo.OSM.Lens.PublicL , module Data.Geo.OSM.Lens.OriginL , module Data.Geo.OSM.Lens.PerPageL , module Data.Geo.OSM.Lens.MaxlonL , module Data.Geo.OSM.Lens.AreaL , module Data.Geo.OSM.Lens.GeneratorL , module Data.Geo.OSM.Lens.RefL , module Data.Geo.OSM.Lens.TracepointsL , module Data.Geo.OSM.Lens.UidL , module Data.Geo.OSM.Lens.MinlonL , module Data.Geo.OSM.Lens.VL , module Data.Geo.OSM.Lens.ChildrenL , module Data.Geo.OSM.Lens.IdL , module Data.Geo.OSM.Lens.MaxlatL , module Data.Geo.OSM.Lens.MinlatL , module Data.Geo.OSM.Lens.NdL , module Data.Geo.OSM.Lens.MinimumL , module Data.Geo.OSM.Lens.MaximumL , module Data.Geo.OSM.Lens.HomeL , module Data.Geo.OSM.Lens.AccountCreatedL , module Data.Geo.OSM.Lens.BoundsL , module Data.Geo.OSM.Lens.KL , module Data.Geo.OSM.Lens.MemberL , module Data.Geo.OSM.Lens.LatL , module Data.Geo.OSM.Lens.VersionL , module Data.Geo.OSM.Lens.WaynodesL , module Data.Geo.OSM.Lens.TimestampL , module Data.Geo.OSM.Lens.PendingL , module Data.Geo.OSM.Lens.DisplayNameL , module Data.Geo.OSM.Lens.VisibleL , module Data.Geo.OSM.Lens.UserL , module Data.Geo.OSM.Lens.LonL , module Data.Geo.OSM.Lens.BoxL , module Data.Geo.OSM.Lens.TagsL , module Data.Geo.OSM.Lens.NameL , module Data.Geo.OSM.Lens.ZoomL , module Data.Geo.OSM.Lens.RoleL , module Data.Geo.OSM.Lens.ChangesetL , module Data.Geo.OSM.Lens.TypeL ) where import Data.Geo.OSM.Lens.PublicL import Data.Geo.OSM.Lens.OriginL import Data.Geo.OSM.Lens.PerPageL import Data.Geo.OSM.Lens.MaxlonL import Data.Geo.OSM.Lens.AreaL import Data.Geo.OSM.Lens.GeneratorL import Data.Geo.OSM.Lens.RefL import Data.Geo.OSM.Lens.TracepointsL import Data.Geo.OSM.Lens.UidL import Data.Geo.OSM.Lens.MinlonL import Data.Geo.OSM.Lens.VL import Data.Geo.OSM.Lens.ChildrenL import Data.Geo.OSM.Lens.IdL import Data.Geo.OSM.Lens.MaxlatL import Data.Geo.OSM.Lens.MinlatL import Data.Geo.OSM.Lens.NdL import Data.Geo.OSM.Lens.MinimumL import Data.Geo.OSM.Lens.MaximumL import Data.Geo.OSM.Lens.HomeL import Data.Geo.OSM.Lens.AccountCreatedL import Data.Geo.OSM.Lens.BoundsL import Data.Geo.OSM.Lens.KL import Data.Geo.OSM.Lens.MemberL import Data.Geo.OSM.Lens.LatL import Data.Geo.OSM.Lens.VersionL import Data.Geo.OSM.Lens.WaynodesL import Data.Geo.OSM.Lens.TimestampL import Data.Geo.OSM.Lens.PendingL import Data.Geo.OSM.Lens.DisplayNameL import Data.Geo.OSM.Lens.VisibleL import Data.Geo.OSM.Lens.UserL import Data.Geo.OSM.Lens.LonL import Data.Geo.OSM.Lens.BoxL import Data.Geo.OSM.Lens.TagsL import Data.Geo.OSM.Lens.NameL import Data.Geo.OSM.Lens.ZoomL import Data.Geo.OSM.Lens.RoleL import Data.Geo.OSM.Lens.ChangesetL import Data.Geo.OSM.Lens.TypeL OSM-0.6.4/src/Data/Geo/OSM/Area.hs0000644000000000000000000000155511710770015014366 0ustar0000000000000000{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses #-} -- | The @area@ element of a OSM file. module Data.Geo.OSM.Area ( Area , area ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Lens.MaximumL import Data.Lens.Common import Control.Comonad.Trans.Store import Control.Newtype -- | The @area@ element of a OSM file. newtype Area = Area String deriving Eq -- | Constructs a @area@ with maximum. area :: String -- ^ The @area@ element. -> Area area = Area instance XmlPickler Area where xpickle = xpElem "area" (xpWrap (area, \(Area r) -> r) (xpAttr "maximum" xpText)) instance Show Area where show = showPickled [] instance MaximumL Area where maximumL = Lens $ \(Area maximum) -> store (\maximum -> Area maximum) maximum instance Newtype Area String where pack = Area unpack (Area x) = x OSM-0.6.4/src/Data/Geo/OSM/Nd.hs0000644000000000000000000000143511710770015014054 0ustar0000000000000000{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses #-} -- | The @nd@ element of a OSM file. module Data.Geo.OSM.Nd ( Nd , nd ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Lens.RefL import Data.Lens.Common import Control.Comonad.Trans.Store import Control.Newtype -- | The @nd@ element of a OSM file. newtype Nd = Nd String deriving Eq instance XmlPickler Nd where xpickle = xpElem "nd" (xpWrap (nd, \(Nd r) -> r) (xpAttr "ref" xpText)) instance Show Nd where show = showPickled [] instance RefL Nd where refL = Lens $ \(Nd ref) -> store (\ref -> Nd ref) ref instance Newtype Nd String where pack = Nd unpack (Nd x) = x -- | Constructs a nd with a ref. nd :: String -- ^ The @ref@ attribute. -> Nd nd = Nd OSM-0.6.4/src/Data/Geo/OSM/Bound.hs0000644000000000000000000000173011710770015014560 0ustar0000000000000000-- | The @bound@ element of a OSM file. module Data.Geo.OSM.Bound ( Bound , bound ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Lens.BoxL import Data.Geo.OSM.Lens.OriginL import Data.Lens.Common import Control.Comonad.Trans.Store -- | The @bound@ element of a OSM file. data Bound = Bound String (Maybe String) deriving Eq instance XmlPickler Bound where xpickle = xpElem "bound" (xpWrap (uncurry bound, \(Bound b o) -> (b, o)) (xpPair (xpAttr "box" xpText) (xpOption (xpAttr "origin" xpText)))) instance Show Bound where show = showPickled [] instance BoxL Bound where boxL = Lens $ \(Bound box origin) -> store (\box -> Bound box origin) box instance OriginL Bound where originL = Lens $ \(Bound box origin) -> store (\origin -> Bound box origin) origin -- | Constructs a bound with a box and origin attributes. bound :: String -- ^ The @box@ attribute. -> Maybe String -- ^ The @origin@ attribute. -> Bound bound = Bound OSM-0.6.4/src/Data/Geo/OSM/Relation.hs0000644000000000000000000000444011710770015015267 0ustar0000000000000000{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} -- | The @relation@ element of a OSM file. module Data.Geo.OSM.Relation ( Relation , relation ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Member import Data.Geo.OSM.NWRCommon import Data.Geo.OSM.Tag 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.Geo.OSM.Lens.MemberL import Data.Lens.Common import Control.Comonad.Trans.Store import Control.Category import Prelude hiding ((.)) -- | The @relation@ element of a OSM file. data Relation = Relation [Member] NWRCommon deriving Eq instance XmlPickler Relation where xpickle = xpElem "relation" (xpWrap (uncurry Relation, \(Relation m r) -> (m, r)) (xpPair (xpList xpickle) xpickle)) instance Show Relation where show = showPickled [] instance MemberL Relation where memberL = Lens $ \(Relation members common) -> store (\members -> Relation members common) members -- not exported commonL :: Lens Relation NWRCommon commonL = Lens (\(Relation members common) -> store (\common -> Relation members common) common) instance IdL Relation where idL = idL . commonL instance TagsL Relation where tagsL = tagsL . commonL instance ChangesetL Relation where changesetL = changesetL . commonL instance VisibleL Relation where visibleL = visibleL . commonL instance UserL Relation (Maybe String) where userL = userL . commonL instance UidL Relation where uidL = uidL . commonL instance TimestampL Relation (Maybe String) where timestampL = timestampL . commonL -- | Constructs a relation with a list of members, id, list of tags, changeset, visible, user&uid and timestamp. relation :: [Member] -- ^ The list of members (@member@ elements). -> String -- ^ The @id@ attribute. -> [Tag] -- ^ The list of tags (@tag@ elements). -> Maybe String -- ^ The @changeset@ attribute. -> Bool -- ^ The @visible@ attribute. -> (Maybe String, Maybe String) -- ^ The @user@ and @uid@ attributes. -> Maybe String -- ^ The @timestamp@ attribute. -> Relation relation = (. nwrCommon) . (.) . (.) . (.) . (.) . (.) . Relation OSM-0.6.4/src/Data/Geo/OSM/OSM.hs0000644000000000000000000001524611710770015014156 0ustar0000000000000000{-# LANGUAGE MultiParamTypeClasses, TypeSynonymInstances, FlexibleInstances #-} -- | The @osm@ element of a OSM file, which is the root element. module Data.Geo.OSM.OSM ( OSM , osm , readOsmFile , readOsmFiles , interactOSMIO , interactsOSMIO , interactOSMIO' , interactsOSMIO' , interactOSM , interactsOSM , interactOSM' , interactsOSM' ) where import Prelude hiding (mapM, foldr) import Text.XML.HXT.Core import Control.Monad hiding (mapM) import Data.Foldable import Data.Traversable import Data.Geo.OSM.Children import Data.Geo.OSM.Bound import Data.Geo.OSM.Bounds import Data.Geo.OSM.BoundOption import Data.Lens.Common import Control.Comonad.Trans.Store import Data.Geo.OSM.Lens.VersionL import Data.Geo.OSM.Lens.GeneratorL import Data.Geo.OSM.Lens.BoundsL import Data.Geo.OSM.Lens.ChildrenL import Data.Monoid -- | The @osm@ element of a OSM file, which is the root element. data OSM = OSM String (Maybe String) (Maybe (Either Bound Bounds)) Children deriving Eq instance XmlPickler OSM where xpickle = xpElem "osm" (xpWrap (\(version', generator', bound', nwr') -> osm version' generator' bound' nwr', \(OSM version' generator' bound' nwr') -> (version', generator', bound', nwr')) (xp4Tuple (xpAttr "version" xpText) (xpOption (xpAttr "generator" xpText)) (xpOption (xpAlt (either (const 0) (const 1)) [xpWrap (Left, \(Left b) -> b) xpickle, xpWrap (Right, \(Right b) -> b) xpickle])) xpickle)) instance Show OSM where show = showPickled [] instance VersionL OSM String where versionL = Lens $ \(OSM version generator bounds children) -> store (\version -> OSM version generator bounds children) version instance BoundsL OSM where boundsL = Lens $ \(OSM version generator bounds children) -> store (\bounds -> OSM version generator (foldBoundOption (Just . Left) (Just . Right) Nothing bounds) children) $ case bounds of Nothing -> optionEmptyBound Just (Left b) -> optionBound b Just (Right b) -> optionBounds b instance GeneratorL OSM where generatorL = Lens $ \(OSM version generator bounds children) -> store (\generator -> OSM version generator bounds children) generator instance ChildrenL OSM where childrenL = Lens $ \(OSM version generator bounds children) -> store (\children -> OSM version generator bounds children) children -- | Constructs a osm with a version, bound or bounds, and node attributes and way or relation elements. osm :: String -- ^ The @version@ attribute. -> Maybe String -- ^ The @generator@ attribute. -> Maybe (Either Bound Bounds) -- ^ The @bound@ or @bounds@ elements. -> Children -- ^ The child elements. -> OSM osm = OSM -- | Reads an OSM file into a list of @OSM@ values removing whitespace. readOsmFile :: FilePath -> IO [OSM] readOsmFile = runX . xunpickleDocument (xpickle :: PU OSM) ([withRemoveWS yes, withFileMimeType v_1]) -- FIXME v_1? -- | Reads 0 or more OSM files into a list of @OSM@ values removing whitespace. readOsmFiles :: [FilePath] -> IO [OSM] readOsmFiles = fmap join . mapM readOsmFile -- | Reads a OSM file, executes the given function on the XML, then writes the given file. interactOSMIO' :: (OSM -> IO OSM) -- ^ The function to execute on the XML that is read. -> SysConfigList -- ^ The options for reading the OSM file. -> FilePath -- ^ The OSM file to read. -> SysConfigList -- ^ The options for writing the OSM file. -> FilePath -- ^ The OSM file to write. -> IO () interactOSMIO' f froma from toa to = runX (xunpickleDocument (xpickle :: PU OSM) froma from >>> arrIO f >>> xpickleDocument (xpickle :: PU OSM) toa to) >> return () -- | Reads a OSM file, executes the given functions on the XML, then writes the given file. interactsOSMIO' :: Foldable t => t (OSM -> IO OSM) -- ^ The function to execute on the XML that is read. -> SysConfigList -- ^ The options for reading the OSM file. -> FilePath -- ^ The OSM file to read. -> SysConfigList -- ^ The options for writing the OSM file. -> FilePath -- ^ The OSM file to write. -> IO () interactsOSMIO' = interactOSMIO' . sumM -- | Reads a OSM file removing whitespace, executes the given function on the XML, then writes the given file with indentation. interactOSMIO :: (OSM -> IO OSM) -- ^ The function to execute on the XML that is read. -> FilePath -- ^ The OSM file to read. -> FilePath -- ^ The OSM file to write. -> IO () interactOSMIO f from = interactOSMIO' f [withRemoveWS yes, withFileMimeType v_1] from [withIndent yes, withFileMimeType v_1] -- | Reads a OSM file removing whitespace, executes the given functions on the XML, then writes the given file with indentation. interactsOSMIO :: Foldable t => t (OSM -> IO OSM) -- ^ The function to execute on the XML that is read. -> FilePath -- ^ The OSM file to read. -> FilePath -- ^ The OSM file to write. -> IO () interactsOSMIO = interactOSMIO . sumM -- | Reads a OSM file, executes the given function on the XML, then writes the given file. interactOSM' :: (OSM -> OSM) -- ^ The function to execute on the XML that is read. -> SysConfigList -- ^ The options for reading the OSM file. -> FilePath -- ^ The OSM file to read. -> SysConfigList -- ^ The options for writing the OSM file. -> FilePath -- ^ The OSM file to write. -> IO () interactOSM' f = interactOSMIO' (return . f) -- | Reads a OSM file, executes the given functions on the XML, then writes the given file. interactsOSM' :: Foldable t => t (OSM -> OSM) -- ^ The functions to execute on the XML that is read. -> SysConfigList -- ^ The options for reading the OSM file. -> FilePath -- ^ The OSM file to read. -> SysConfigList -- ^ The options for writing the OSM file. -> FilePath -- ^ The OSM file to write. -> IO () interactsOSM' = interactOSM' . sum' -- | Reads a OSM file removing whitespace, executes the given function on the XML, then writes the given file with indentation. interactOSM :: (OSM -> OSM) -- ^ The function to execute on the XML that is read. -> FilePath -- ^ The OSM file to read. -> FilePath -- ^ The OSM file to write. -> IO () interactOSM f = interactOSMIO (return . f) -- | Reads a OSM file removing whitespace, executes the given functions on the XML, then writes the given file with indentation. interactsOSM :: Foldable t => t (OSM -> OSM) -- ^ The function to execute on the XML that is read. -> FilePath -- ^ The OSM file to read. -> FilePath -- ^ The OSM file to write. -> IO () interactsOSM = interactOSM . sum' -- not exported sum' :: Foldable t => t (a -> a) -> a -> a sum' = appEndo . foldMap Endo sumM :: (Monad m, Foldable t) => t (a -> m a) -> a -> m a sumM = foldr (>=>) return OSM-0.6.4/src/Data/Geo/OSM/Tracepoints.hs0000644000000000000000000000203011710770015015776 0ustar0000000000000000{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses #-} -- | The @tracepoints@ element of a OSM file. module Data.Geo.OSM.Tracepoints ( Tracepoints , tracepoints ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Lens.PerPageL import Data.Lens.Common import Control.Comonad.Trans.Store import Control.Newtype -- | The @tracepoints@ element of a OSM file. newtype Tracepoints = Tracepoints String deriving Eq -- | Constructs a @tracepoints@ with per_page. tracepoints :: String -- ^ The @per_page@ attribute. -> Tracepoints tracepoints = Tracepoints instance XmlPickler Tracepoints where xpickle = xpElem "tracepoints" (xpWrap (tracepoints, \(Tracepoints r) -> r) (xpAttr "per_page" xpText)) instance Show Tracepoints where show = showPickled [] instance PerPageL Tracepoints where perPageL = Lens $ \(Tracepoints perPage) -> store (\perPage -> Tracepoints perPage) perPage instance Newtype Tracepoints String where pack = Tracepoints unpack (Tracepoints x) = x OSM-0.6.4/src/Data/Geo/OSM/Node.hs0000644000000000000000000000457011710770015014403 0ustar0000000000000000{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} -- | The @node@ element of a OSM file. 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 ((.)) -- | The @node@ element of a OSM file. 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 -- not exported 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 -- | Constructs a node with a lat, lon, id, list of tags, changeset, visible, user&uid and timestamp. node :: String -- ^ The @lat@ attribute. -> String -- ^ The @lon@ attribute. -> String -- ^ The @id@ attribute. -> [Tag] -- ^ The list of tags (@tag@ elements). -> Maybe String -- ^ The @changeset@ attribute. -> Bool -- ^ The @visible@ attribute. -> (Maybe String, Maybe String) -- ^ The @user@ and @uid@ attributes. -> Maybe String -- ^ The @timestamp@ attribute. -> Node node = flip flip nwrCommon . (((.) . (.) . (.) . (.) . (.) . (.)) .) . Node OSM-0.6.4/src/Data/Geo/OSM/Tag.hs0000644000000000000000000000151311710770015014223 0ustar0000000000000000-- | The @tag@ element of a OSM file. module Data.Geo.OSM.Tag ( Tag , tag ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Lens.KL import Data.Geo.OSM.Lens.VL import Data.Lens.Common import Control.Comonad.Trans.Store -- | The @tag@ element of a OSM file. data Tag = Tag String String deriving Eq instance XmlPickler Tag where xpickle = xpElem "tag" (xpWrap (uncurry tag, \(Tag k' v') -> (k', v')) (xpPair (xpAttr "k" xpText) (xpAttr "v" xpText))) instance Show Tag where show = showPickled [] instance KL Tag where kL = Lens $ \(Tag k v) -> store (\k -> Tag k v) k instance VL Tag where vL = Lens $ \(Tag k v) -> store (\v -> Tag k v) v -- | Constructs a tag with a key and value. tag :: String -- ^ The key (@k@ attribute). -> String -- ^ The value (@v@ attribute). -> Tag tag = Tag OSM-0.6.4/src/Data/Geo/OSM/Member.hs0000644000000000000000000000245611710770015014726 0ustar0000000000000000-- | The @member@ element of a OSM file. module Data.Geo.OSM.Member ( Member , member ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.MemberType import Data.Geo.OSM.Lens.TypeL import Data.Geo.OSM.Lens.RefL import Data.Geo.OSM.Lens.RoleL import Data.Lens.Common import Control.Comonad.Trans.Store -- | The @member@ element of a OSM file. data Member = Member MemberType String String deriving Eq instance XmlPickler Member where xpickle = xpElem "member" (xpWrap (\(mtype', mref', mrole') -> member mtype' mref' mrole', \(Member mtype' mref' mrole') -> (mtype', mref', mrole')) (xpTriple xpickle (xpAttr "ref" xpText) (xpAttr "role" xpText))) instance Show Member where show = showPickled [] instance TypeL Member where typeL = Lens $ \(Member typ ref role) -> store (\typ -> Member typ ref role) typ instance RefL Member where refL = Lens $ \(Member typ ref role) -> store (\ref -> Member typ ref role) ref instance RoleL Member where roleL = Lens $ \(Member typ ref role) -> store (\role -> Member typ ref role) role -- | Constructs a member with a type, ref and role. member :: MemberType -- ^ The member @type@ attribute. -> String -- ^ The member @ref@ attribute. -> String -- ^ The member @role@ attribute. -> Member member = Member OSM-0.6.4/src/Data/Geo/OSM/Home.hs0000644000000000000000000000224311710770015014401 0ustar0000000000000000-- | The @home@ element of a OSM file. module Data.Geo.OSM.Home ( Home , home ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Lens.LatL import Data.Geo.OSM.Lens.LonL import Data.Geo.OSM.Lens.ZoomL import Data.Lens.Common import Control.Comonad.Trans.Store -- | The @home@ element of a OSM file. data Home = Home String String String deriving Eq -- | Constructs a @home@ with lat, lon and zoom. home :: String -- ^ The @lat@ attribute. -> String -- ^ The @lon@ attribute. -> String -- ^ The @zoom@ attribute. -> Home home = Home instance XmlPickler Home where xpickle = xpElem "home" (xpWrap (\(lat', lon', zoom') -> home lat' lon' zoom', \(Home lat' lon' zoom') -> (lat', lon', zoom')) (xpTriple (xpAttr "lat" xpText) (xpAttr "lon" xpText) (xpAttr "zoom" xpText))) instance Show Home where show = showPickled [] instance LatL Home where latL = Lens $ \(Home lat lon zoom) -> store (\lat -> Home lat lon zoom) lat instance LonL Home where lonL = Lens $ \(Home lat lon zoom) -> store (\lon -> Home lat lon zoom) lon instance ZoomL Home where zoomL = Lens $ \(Home lat lon zoom) -> store (\zoom -> Home lat lon zoom) zoom OSM-0.6.4/src/Data/Geo/OSM/MemberType.hs0000644000000000000000000000302311710770015015557 0ustar0000000000000000-- | The @type@ attribute of a @member@ element of a OSM file. module Data.Geo.OSM.MemberType ( MemberType , foldMemberType , wayType , nodeType , relationType ) where import Text.XML.HXT.Arrow.Pickle import Data.Char -- | The @type@ attribute of a @member@ element of a OSM file. data MemberType = WayType | NodeType | RelationType deriving Eq -- | Folds a member-type (catamorphism). foldMemberType :: MemberType -- ^ The member-type to fold. -> x -- ^ If the type is a way. -> x -- ^ If the type is a node. -> x -- ^ If the type is a relation. -> x foldMemberType WayType x _ _ = x foldMemberType NodeType _ x _ = x foldMemberType RelationType _ _ x = x instance XmlPickler MemberType where xpickle = xpWrapMaybe (\s -> case fmap toLower s of "way" -> Just WayType "node" -> Just NodeType "relation" -> Just RelationType _ -> Nothing, \t -> case t of WayType -> "way" NodeType -> "node" RelationType -> "relation") (xpAttr "type" xpText) instance Show MemberType where show = showPickled [] -- | Constructs a member-type that is a way. wayType :: MemberType wayType = WayType -- | Constructs a member-type that is a node. nodeType :: MemberType nodeType = NodeType -- | Constructs a member-type that is a relation. relationType :: MemberType relationType = RelationType OSM-0.6.4/src/Data/Geo/OSM/NodeWayRelation.hs0000644000000000000000000000366211710770015016563 0ustar0000000000000000-- | The @node@, @way@, or @relation@ element of a OSM file. module Data.Geo.OSM.NodeWayRelation ( NodeWayRelation , foldNodeWayRelation , way' , relation' , node' , isNode , isWay , isRelation ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Node import Data.Geo.OSM.Way import Data.Geo.OSM.Relation -- | The @node@, @way@, or @relation@ element of a OSM file. data NodeWayRelation = N Node | W Way | R Relation deriving Eq -- | Folds a node-way-relation (catamorphism). foldNodeWayRelation :: NodeWayRelation -- ^ The @node@, @way@ or @relation@ element. -> (Node -> x) -- ^ If this is a @node@ element. -> (Way -> x) -- ^ If this is a @way@ element. -> (Relation -> x) -- ^ If this is a @relation@ element. -> x foldNodeWayRelation (N n) x _ _ = x n foldNodeWayRelation (W w) _ x _ = x w foldNodeWayRelation (R r) _ _ x = x r instance XmlPickler NodeWayRelation where xpickle = xpAlt (\r -> case r of N _ -> 0 W _ -> 1 R _ -> 2) [xpWrap (N, \(N n) -> n) xpickle, xpWrap (W, \(W w) -> w) xpickle, xpWrap (R, \(R r) -> r) xpickle] instance Show NodeWayRelation where show = showPickled [] -- | Construct a @way@ element value. way' :: Way -> NodeWayRelation way' = W -- | Construct a @relation@ element value. relation' :: Relation -> NodeWayRelation relation' = R -- | Construct a @node@ element value. node' :: Node -> NodeWayRelation node' = N -- | Returns whether the @node@, @way@ or @relation@ element is a node. isNode :: NodeWayRelation -> Bool isNode (N _) = True isNode _ = False -- | Returns whether the @node@, @way@ or @relation@ element is a way. isWay :: NodeWayRelation -> Bool isWay (W _) = True isWay _ = False -- | Returns whether the @node@, @way@ or @relation@ element is a relation. isRelation :: NodeWayRelation -> Bool isRelation (R _) = True isRelation _ = False OSM-0.6.4/src/Data/Geo/OSM/Api.hs0000644000000000000000000000366711710770015014235 0ustar0000000000000000{-# LANGUAGE MultiParamTypeClasses, TypeSynonymInstances, FlexibleInstances #-} -- | The @api@ element of a OSM file. module Data.Geo.OSM.Api ( Api , api ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.Version import Data.Geo.OSM.Area import Data.Geo.OSM.Tracepoints import Data.Geo.OSM.Waynodes import Data.Lens.Common import Control.Comonad.Trans.Store import Data.Geo.OSM.Lens.VersionL import Data.Geo.OSM.Lens.AreaL import Data.Geo.OSM.Lens.TracepointsL import Data.Geo.OSM.Lens.WaynodesL -- | The @api@ element of a OSM file. data Api = Api Version Area Tracepoints Waynodes deriving Eq -- | Constructs a @api@ with version, area, tracepoints and waynodes. api :: Version -- ^ The @version@ element. -> Area -- ^ The @area@ element. -> Tracepoints -- ^ The @tracepoints@ element. -> Waynodes -- ^ The @waynodes@ element. -> Api api = Api instance XmlPickler Api where xpickle = xpElem "api" (xpWrap (\(version', area', tracepoints', waypoints') -> api version' area' tracepoints' waypoints', \(Api version' area' tracepoints' waynodes') -> (version', area', tracepoints', waynodes')) (xp4Tuple (xpElem "version" xpickle) (xpElem "area" xpickle) (xpElem "tracepoints" xpickle) (xpElem "waynodes" xpickle))) instance Show Api where show = showPickled [] instance VersionL Api Version where versionL = Lens $ \(Api version area tracepoints waynodes) -> store (\version -> Api version area tracepoints waynodes) version instance AreaL Api where areaL = Lens $ \(Api version area tracepoints waynodes) -> store (\area -> Api version area tracepoints waynodes) area instance TracepointsL Api where tracepointsL = Lens $ \(Api version area tracepoints waynodes) -> store (\tracepoints -> Api version area tracepoints waynodes) tracepoints instance WaynodesL Api where waynodesL = Lens $ \(Api version area tracepoints waynodes) -> store (\waynodes -> Api version area tracepoints waynodes) waynodes OSM-0.6.4/src/Data/Geo/OSM/Children.hs0000644000000000000000000000511711710770015015244 0ustar0000000000000000-- | The children elements of the @osm@ element of a OSM file. module Data.Geo.OSM.Children ( Children , osmUser , osmGpxFile , osmApi , osmChangeset , osmNodeWayRelation , foldChildren ) where import Text.XML.HXT.Arrow.Pickle import Data.Geo.OSM.User import Data.Geo.OSM.Preferences import Data.Geo.OSM.GpxFile import Data.Geo.OSM.Api import Data.Geo.OSM.Changeset import Data.Geo.OSM.NodeWayRelation -- | The children elements of the @osm@ element of a OSM file. data Children = User User | Preferences Preferences | GpxFile GpxFile | Api Api | Changeset Changeset | NWR [NodeWayRelation] deriving Eq instance XmlPickler Children where xpickle = xpAlt (\r -> case r of User _ -> 0 Preferences _ -> 1 GpxFile _ -> 2 Api _ -> 3 Changeset _ -> 4 NWR _ -> 5) [xpWrap (User, \(User u) -> u) xpickle, xpWrap (Preferences, \(Preferences p) -> p) xpickle, xpWrap (GpxFile, \(GpxFile f) -> f) xpickle, xpWrap (Api, \(Api a) -> a) xpickle, xpWrap (Changeset, \(Changeset c) -> c) xpickle, xpWrap (NWR, \(NWR k) -> k) (xpList xpickle)] instance Show Children where show = showPickled [] -- | A @user@ element. osmUser :: User -> Children osmUser = User -- | A @gpx_file@ element. osmGpxFile :: GpxFile -> Children osmGpxFile = GpxFile -- | A @api@ element. osmApi :: Api -> Children osmApi = Api -- | A @changeset@ element. osmChangeset :: Changeset -> Children osmChangeset = Changeset -- | A list of @node@, @way@ or @relation@ elements. osmNodeWayRelation :: [NodeWayRelation] -> Children osmNodeWayRelation = NWR -- | Folds OSM child elements (catamorphism). foldChildren :: (User -> a) -- ^ If a @user@ element. -> (Preferences -> a) -- ^ If a @preferences@ element. -> (GpxFile -> a) -- ^ If a @gpx_file@ element. -> (Api -> a) -- ^ If a @api@ element. -> (Changeset -> a) -- ^ If a @changeset@ element. -> ([NodeWayRelation] -> a) -- ^ If a list of @node@, @way@ or @relation@ elements. -> Children -- ^ The disjunctive type of child elements. -> a foldChildren z _ _ _ _ _ (User u) = z u foldChildren _ z _ _ _ _ (Preferences p) = z p foldChildren _ _ z _ _ _ (GpxFile f) = z f foldChildren _ _ _ z _ _ (Api a) = z a foldChildren _ _ _ _ z _ (Changeset c) = z c foldChildren _ _ _ _ _ z (NWR k) = z k OSM-0.6.4/src/Data/Geo/OSM/NWRCommon.hs0000644000000000000000000000673011710770015015335 0ustar0000000000000000{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} -- | The common attributes between the @node@, @way@ and @relation@ elements. module Data.Geo.OSM.NWRCommon ( NWRCommon , nwrCommon ) where import Text.XML.HXT.Arrow.Pickle import Control.Applicative import Data.Char import Data.Geo.OSM.Tag 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 -- | The common attributes between the @node@, @way@ and @relation@ elements. data NWRCommon = NWRCommon String [Tag] (Maybe String) Bool (Maybe String, Maybe String) (Maybe String) deriving Eq instance XmlPickler NWRCommon where xpickle = xpWrap (\(a, b, c, d, e, f) -> nwrCommon a b c d e f, \(NWRCommon a b c d e f) -> (a, b, c, d, e, f)) (xp6Tuple (xpAttr "id" xpText) (xpList xpickle) (xpOption (xpAttr "changeset" xpText)) (xpDefault True (xpWrapMaybe (\s -> case toLower <$> s of "true" -> Just True "false" -> Just False _ -> Nothing, (toLower <$>) . show) (xpAttr "visible" xpText))) (xpPair (xpOption (xpAttr "user" xpText)) (xpOption (xpAttr "uid" xpText))) (xpOption (xpAttr "timestamp" xpText))) instance Show NWRCommon where show = showPickled [] instance IdL NWRCommon where idL = Lens $ \(NWRCommon id tags changeset visible (user, uid) timestamp) -> store (\id -> NWRCommon id tags changeset visible (user, uid) timestamp) id instance TagsL NWRCommon where tagsL = Lens $ \(NWRCommon id tags changeset visible (user, uid) timestamp) -> store (\tags -> NWRCommon id tags changeset visible (user, uid) timestamp) tags instance ChangesetL NWRCommon where changesetL = Lens $ \(NWRCommon id tags changeset visible (user, uid) timestamp) -> store (\changeset -> NWRCommon id tags changeset visible (user, uid) timestamp) changeset instance VisibleL NWRCommon where visibleL = Lens $ \(NWRCommon id tags changeset visible (user, uid) timestamp) -> store (\visible -> NWRCommon id tags changeset visible (user, uid) timestamp) visible instance UserL NWRCommon (Maybe String) where userL = Lens $ \(NWRCommon id tags changeset visible (user, uid) timestamp) -> store (\user -> NWRCommon id tags changeset visible (user, uid) timestamp) user instance UidL NWRCommon where uidL = Lens $ \(NWRCommon id tags changeset visible (user, uid) timestamp) -> store (\uid -> NWRCommon id tags changeset visible (user, uid) timestamp) uid instance TimestampL NWRCommon (Maybe String) where timestampL = Lens $ \(NWRCommon id tags changeset visible (user, uid) timestamp) -> store (\timestamp -> NWRCommon id tags changeset visible (user, uid) timestamp) timestamp -- | Constructs with id, list of tags, changeset, visible, user&uid and timestamp. nwrCommon :: String -- ^ The @id@ attribute. -> [Tag] -- ^ The list of tags (@tag@ elements). -> Maybe String -- ^ The @changeset@ attribute. -> Bool -- ^ The @visible@ attribute. -> (Maybe String, Maybe String) -- ^ The @user@ and @uid@ attributes. -> Maybe String -- ^ The @timestamp@ attribute. -> NWRCommon nwrCommon = NWRCommon OSM-0.6.4/src/Data/Geo/OSM/GpxFile.hs0000644000000000000000000000674711710770015015064 0ustar0000000000000000{-# LANGUAGE MultiParamTypeClasses, TypeSynonymInstances, FlexibleInstances #-} -- | The @gpx_file@ element of a OSM file. module Data.Geo.OSM.GpxFile ( GpxFile , gpxFile ) where import Text.XML.HXT.Arrow.Pickle import Data.Char import Data.Geo.OSM.Lens.IdL import Data.Geo.OSM.Lens.NameL import Data.Geo.OSM.Lens.LatL import Data.Geo.OSM.Lens.LonL import Data.Geo.OSM.Lens.UserL import Data.Geo.OSM.Lens.PublicL import Data.Geo.OSM.Lens.PendingL import Data.Geo.OSM.Lens.TimestampL import Data.Lens.Common import Control.Comonad.Trans.Store -- | The @gpx_file@ element of a OSM file. data GpxFile = GpxFile String String String String String Bool Bool String deriving Eq -- | Constructs a @gpx_file@ with an id, name, lat, lon, user, public, pending and timestamp. gpxFile :: String -- ^ The @id@ attribute. -> String -- ^ The @name@ attribute. -> String -- ^ The @lat@ attribute. -> String -- ^ The @lon@ attribute. -> String -- ^ The @user@ attribute. -> Bool -- ^ The @public@ attribute. -> Bool -- ^ The @pending@ attribute. -> String -- ^ The @timestamp@ attribute. -> GpxFile gpxFile = GpxFile instance XmlPickler GpxFile where xpickle = let b = xpWrapMaybe (\s -> case fmap toLower s of "true" -> Just True "false" -> Just False _ -> Nothing, fmap toLower . show) in xpElem "gpx_file" (xpWrap (\(id'', name', lat', lon', user', public', pending', timestamp') -> gpxFile id'' name' lat' lon' user' public' pending' timestamp', \(GpxFile id'' name' lat' lon' user' public' pending' timestamp') -> (id'', name', lat', lon', user', public', pending', timestamp')) (xp8Tuple (xpAttr "id" xpText) (xpAttr "name" xpText) (xpAttr "lat" xpText) (xpAttr "lon" xpText) (xpAttr "user" xpText) (xpDefault False (b (xpAttr "public" xpText))) (xpDefault False (b (xpAttr "pending" xpText))) (xpAttr "timestamp" xpText))) instance Show GpxFile where show = showPickled [] instance IdL GpxFile where idL = Lens $ \(GpxFile id name lat lon user public pending timestamp) -> store (\id -> GpxFile id name lat lon user public pending timestamp) id instance NameL GpxFile where nameL = Lens $ \(GpxFile id name lat lon user public pending timestamp) -> store (\name -> GpxFile id name lat lon user public pending timestamp) name instance LatL GpxFile where latL = Lens $ \(GpxFile id name lat lon user public pending timestamp) -> store (\lat -> GpxFile id name lat lon user public pending timestamp) lat instance LonL GpxFile where lonL = Lens $ \(GpxFile id name lat lon user public pending timestamp) -> store (\lon -> GpxFile id name lat lon user public pending timestamp) lon instance UserL GpxFile String where userL = Lens $ \(GpxFile id name lat lon user public pending timestamp) -> store (\user -> GpxFile id name lat lon user public pending timestamp) user instance PublicL GpxFile where publicL = Lens $ \(GpxFile id name lat lon user public pending timestamp) -> store (\public -> GpxFile id name lat lon user public pending timestamp) public instance PendingL GpxFile where pendingL = Lens $ \(GpxFile id name lat lon user public pending timestamp) -> store (\pending -> GpxFile id name lat lon user public pending timestamp) pending instance TimestampL GpxFile String where timestampL = Lens $ \(GpxFile id name lat lon user public pending timestamp) -> store (\timestamp -> GpxFile id name lat lon user public pending timestamp) timestamp OSM-0.6.4/src/Data/Geo/OSM/Lens/0000755000000000000000000000000011710770016014056 5ustar0000000000000000OSM-0.6.4/src/Data/Geo/OSM/Lens/RefL.hs0000644000000000000000000000023011710770016015235 0ustar0000000000000000-- | Values with a @ref@ string accessor. module Data.Geo.OSM.Lens.RefL where import Data.Lens.Common class RefL a where refL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/OriginL.hs0000644000000000000000000000026611710770016015761 0ustar0000000000000000-- | Values with a @origin@ optional string accessor. module Data.Geo.OSM.Lens.OriginL where import Data.Lens.Common class OriginL a where originL :: Lens a (Maybe String) OSM-0.6.4/src/Data/Geo/OSM/Lens/MaximumL.hs0000644000000000000000000000025111710770016016141 0ustar0000000000000000-- | Values with a @maximum@ string accessor. module Data.Geo.OSM.Lens.MaximumL where import Data.Lens.Common class MaximumL a where maximumL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/KL.hs0000644000000000000000000000022011710770016014712 0ustar0000000000000000-- | Values with a @k@ string accessor. module Data.Geo.OSM.Lens.KL where import Data.Lens.Common class KL a where kL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/WaynodesL.hs0000644000000000000000000000031311710770016016314 0ustar0000000000000000-- | Values with a @waynodes@ string accessor. module Data.Geo.OSM.Lens.WaynodesL where import Data.Geo.OSM.Waynodes import Data.Lens.Common class WaynodesL a where waynodesL :: Lens a Waynodes OSM-0.6.4/src/Data/Geo/OSM/Lens/PendingL.hs0000644000000000000000000000024711710770016016115 0ustar0000000000000000-- | Values with a @pending@ boolean accessor. module Data.Geo.OSM.Lens.PendingL where import Data.Lens.Common class PendingL a where pendingL :: Lens a Bool OSM-0.6.4/src/Data/Geo/OSM/Lens/ZoomL.hs0000644000000000000000000000023311710770016015450 0ustar0000000000000000-- | Values with a @zoom@ string accessor. module Data.Geo.OSM.Lens.ZoomL where import Data.Lens.Common class ZoomL a where zoomL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/MinlonL.hs0000644000000000000000000000024411710770016015762 0ustar0000000000000000-- | Values with a @minlon@ string accessor. module Data.Geo.OSM.Lens.MinlonL where import Data.Lens.Common class MinlonL a where minlonL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/TracepointsL.hs0000644000000000000000000000033511710770016017022 0ustar0000000000000000-- | Values with a @tracepoints@ string accessor. module Data.Geo.OSM.Lens.TracepointsL where import Data.Geo.OSM.Tracepoints import Data.Lens.Common class TracepointsL a where tracepointsL :: Lens a Tracepoints OSM-0.6.4/src/Data/Geo/OSM/Lens/HomeL.hs0000644000000000000000000000030411710770016015413 0ustar0000000000000000-- | Values with a @home@ optional string accessor. module Data.Geo.OSM.Lens.HomeL where import Data.Lens.Common import Data.Geo.OSM.Home class HomeL a where homeL :: Lens a (Maybe Home) OSM-0.6.4/src/Data/Geo/OSM/Lens/BoundsL.hs0000644000000000000000000000036111710770016015760 0ustar0000000000000000-- | Values with a @bounds@ accessor which is either empty, a @Bound@ or a @Bounds@. module Data.Geo.OSM.Lens.BoundsL where import Data.Lens.Common import Data.Geo.OSM.BoundOption class BoundsL a where boundsL :: Lens a BoundOption OSM-0.6.4/src/Data/Geo/OSM/Lens/ChildrenL.hs0000644000000000000000000000032611710770016016257 0ustar0000000000000000-- | Values with node, way or relation children accessor. module Data.Geo.OSM.Lens.ChildrenL where import Data.Geo.OSM.Children import Data.Lens.Common class ChildrenL a where childrenL :: Lens a Children OSM-0.6.4/src/Data/Geo/OSM/Lens/VL.hs0000644000000000000000000000022011710770016014725 0ustar0000000000000000-- | Values with a @v@ string accessor. module Data.Geo.OSM.Lens.VL where import Data.Lens.Common class VL a where vL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/MaxlatL.hs0000644000000000000000000000024511710770016015755 0ustar0000000000000000-- | Values with a @maxlat@ string accessor. module Data.Geo.OSM.Lens.MaxlatL where import Data.Lens.Common class MaxlatL a where maxlatL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/GeneratorL.hs0000644000000000000000000000030111710770016016446 0ustar0000000000000000-- | Values with a @generator@ optional string accessor. module Data.Geo.OSM.Lens.GeneratorL where import Data.Lens.Common class GeneratorL a where generatorL :: Lens a (Maybe String) OSM-0.6.4/src/Data/Geo/OSM/Lens/IdL.hs0000644000000000000000000000022411710770016015060 0ustar0000000000000000-- | Values with a @id@ string accessor. module Data.Geo.OSM.Lens.IdL where import Data.Lens.Common class IdL a where idL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/MinimumL.hs0000644000000000000000000000025011710770016016136 0ustar0000000000000000-- | Values with a @minimum@ string accessor. module Data.Geo.OSM.Lens.MinimumL where import Data.Lens.Common class MinimumL a where minimumL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/PerPageL.hs0000644000000000000000000000025111710770016016047 0ustar0000000000000000-- | Values with a @per_page@ string accessor. module Data.Geo.OSM.Lens.PerPageL where import Data.Lens.Common class PerPageL a where perPageL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/TagsL.hs0000644000000000000000000000030311710770016015420 0ustar0000000000000000-- | Values with a @tags@ accessor that is a list of tags. module Data.Geo.OSM.Lens.TagsL where import Data.Geo.OSM.Tag import Data.Lens.Common class TagsL a where tagsL :: Lens a [Tag] OSM-0.6.4/src/Data/Geo/OSM/Lens/LatL.hs0000644000000000000000000000023011710770016015241 0ustar0000000000000000-- | Values with a @lat@ string accessor. module Data.Geo.OSM.Lens.LatL where import Data.Lens.Common class LatL a where latL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/MemberL.hs0000644000000000000000000000032511710770016015735 0ustar0000000000000000-- | Values with a @member@ accessor that is a list of @Member@. module Data.Geo.OSM.Lens.MemberL where import Data.Geo.OSM.Member import Data.Lens.Common class MemberL a where memberL :: Lens a [Member] OSM-0.6.4/src/Data/Geo/OSM/Lens/PublicL.hs0000644000000000000000000000024611710770016015746 0ustar0000000000000000-- -- | Values with a @public@ boolean accessor. module Data.Geo.OSM.Lens.PublicL where import Data.Lens.Common class PublicL a where publicL :: Lens a Bool OSM-0.6.4/src/Data/Geo/OSM/Lens/VersionL.hs0000644000000000000000000000034711710770016016157 0ustar0000000000000000{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-} -- | Values with a @version@ accessor. module Data.Geo.OSM.Lens.VersionL where import Data.Lens.Common class VersionL a b | a -> b where versionL :: Lens a b OSM-0.6.4/src/Data/Geo/OSM/Lens/RoleL.hs0000644000000000000000000000023411710770016015426 0ustar0000000000000000-- | Values with a @role@ string accessor. module Data.Geo.OSM.Lens.RoleL where import Data.Lens.Common class RoleL a where roleL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/MinlatL.hs0000644000000000000000000000024411710770016015752 0ustar0000000000000000-- | Values with a @minlat@ string accessor. module Data.Geo.OSM.Lens.MinlatL where import Data.Lens.Common class MinlatL a where minlatL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/TimestampL.hs0000644000000000000000000000035711710770016016476 0ustar0000000000000000{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-} -- | Values with a @timestamp@ accessor. module Data.Geo.OSM.Lens.TimestampL where import Data.Lens.Common class TimestampL a b | a -> b where timestampL :: Lens a b OSM-0.6.4/src/Data/Geo/OSM/Lens/AccountCreatedL.hs0000644000000000000000000000030511710770016017410 0ustar0000000000000000-- | Values with a @account_created@ string accessor. module Data.Geo.OSM.Lens.AccountCreatedL where import Data.Lens.Common class AccountCreatedL a where accountCreatedL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/TypeL.hs0000644000000000000000000000027011710770016015446 0ustar0000000000000000-- | Values with a @type@ accessor. module Data.Geo.OSM.Lens.TypeL where import Data.Geo.OSM.MemberType import Data.Lens.Common class TypeL a where typeL :: Lens a MemberType OSM-0.6.4/src/Data/Geo/OSM/Lens/UidL.hs0000644000000000000000000000025111710770016015245 0ustar0000000000000000-- | Values with a @uid@ optional string accessor. module Data.Geo.OSM.Lens.UidL where import Data.Lens.Common class UidL a where uidL :: Lens a (Maybe String) OSM-0.6.4/src/Data/Geo/OSM/Lens/NdL.hs0000644000000000000000000000027111710770016015067 0ustar0000000000000000-- | Values with a @nd@ accessor that is a list of @Nd@. module Data.Geo.OSM.Lens.NdL where import Data.Geo.OSM.Nd import Data.Lens.Common class NdL a where ndL :: Lens a [Nd] OSM-0.6.4/src/Data/Geo/OSM/Lens/UserL.hs0000644000000000000000000000033311710770016015443 0ustar0000000000000000{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-} -- | Values with a @user@ accessor. module Data.Geo.OSM.Lens.UserL where import Data.Lens.Common class UserL a b | a -> b where userL :: Lens a b OSM-0.6.4/src/Data/Geo/OSM/Lens/DisplayNameL.hs0000644000000000000000000000027111710770016016734 0ustar0000000000000000-- | Values with a @display_name@ string accessor. module Data.Geo.OSM.Lens.DisplayNameL where import Data.Lens.Common class DisplayNameL a where displayNameL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/VisibleL.hs0000644000000000000000000000024711710770016016126 0ustar0000000000000000-- | Values with a @visible@ boolean accessor. module Data.Geo.OSM.Lens.VisibleL where import Data.Lens.Common class VisibleL a where visibleL :: Lens a Bool OSM-0.6.4/src/Data/Geo/OSM/Lens/MaxlonL.hs0000644000000000000000000000024711710770016015767 0ustar0000000000000000-- -- | Values with a @maxlon@ string accessor. module Data.Geo.OSM.Lens.MaxlonL where import Data.Lens.Common class MaxlonL a where maxlonL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/AreaL.hs0000644000000000000000000000026211710770016015376 0ustar0000000000000000-- | Values with a @area@ string accessor. module Data.Geo.OSM.Lens.AreaL where import Data.Geo.OSM.Area import Data.Lens.Common class AreaL a where areaL :: Lens a Area OSM-0.6.4/src/Data/Geo/OSM/Lens/LonL.hs0000644000000000000000000000023011710770016015251 0ustar0000000000000000-- | Values with a @lon@ string accessor. module Data.Geo.OSM.Lens.LonL where import Data.Lens.Common class LonL a where lonL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/BoxL.hs0000644000000000000000000000023011710770016015251 0ustar0000000000000000-- | Values with a @box@ string accessor. module Data.Geo.OSM.Lens.BoxL where import Data.Lens.Common class BoxL a where boxL :: Lens a String OSM-0.6.4/src/Data/Geo/OSM/Lens/ChangesetL.hs0000644000000000000000000000030111710770016016421 0ustar0000000000000000-- | Values with a @changeset@ optional string accessor. module Data.Geo.OSM.Lens.ChangesetL where import Data.Lens.Common class ChangesetL a where changesetL :: Lens a (Maybe String) OSM-0.6.4/src/Data/Geo/OSM/Lens/NameL.hs0000644000000000000000000000023711710770016015410 0ustar0000000000000000-- -- | Values with a @name@ string accessor. module Data.Geo.OSM.Lens.NameL where import Data.Lens.Common class NameL a where nameL :: Lens a String