GPX 0.4.1 → 0.4.2
raw patch · 51 files changed
+409/−4 lines, 51 files
Files
- Data/Geo/GPX/Accessor/Ageofdgpsdata.hs +8/−0
- Data/Geo/GPX/Accessor/Author.hs +4/−0
- Data/Geo/GPX/Accessor/Bounds.hs +7/−0
- Data/Geo/GPX/Accessor/Cmt.hs +8/−0
- Data/Geo/GPX/Accessor/Copyright.hs +7/−0
- Data/Geo/GPX/Accessor/Creator.hs +5/−0
- Data/Geo/GPX/Accessor/Desc.hs +8/−0
- Data/Geo/GPX/Accessor/Dgpsid.hs +7/−0
- Data/Geo/GPX/Accessor/Domain.hs +5/−0
- Data/Geo/GPX/Accessor/Ele.hs +8/−0
- Data/Geo/GPX/Accessor/Email.hs +7/−0
- Data/Geo/GPX/Accessor/Extensions.hs +7/−0
- Data/Geo/GPX/Accessor/Fix.hs +7/−0
- Data/Geo/GPX/Accessor/Geoidheight.hs +8/−0
- Data/Geo/GPX/Accessor/Hdop.hs +8/−0
- Data/Geo/GPX/Accessor/Href.hs +5/−0
- Data/Geo/GPX/Accessor/Id.hs +6/−0
- Data/Geo/GPX/Accessor/Keywords.hs +8/−0
- Data/Geo/GPX/Accessor/Lat.hs +4/−0
- Data/Geo/GPX/Accessor/Latlon.hs +4/−0
- Data/Geo/GPX/Accessor/License.hs +8/−0
- Data/Geo/GPX/Accessor/Link.hs +7/−0
- Data/Geo/GPX/Accessor/Links.hs +7/−0
- Data/Geo/GPX/Accessor/Lon.hs +4/−0
- Data/Geo/GPX/Accessor/Magvar.hs +7/−0
- Data/Geo/GPX/Accessor/Maxlat.hs +4/−0
- Data/Geo/GPX/Accessor/Maxlon.hs +4/−1
- Data/Geo/GPX/Accessor/Metadata.hs +7/−0
- Data/Geo/GPX/Accessor/Minlat.hs +4/−0
- Data/Geo/GPX/Accessor/Minlon.hs +4/−0
- Data/Geo/GPX/Accessor/Name.hs +8/−0
- Data/Geo/GPX/Accessor/Number.hs +8/−0
- Data/Geo/GPX/Accessor/Pdop.hs +8/−0
- Data/Geo/GPX/Accessor/Pts.hs +7/−0
- Data/Geo/GPX/Accessor/Rtepts.hs +7/−0
- Data/Geo/GPX/Accessor/Rtes.hs +7/−0
- Data/Geo/GPX/Accessor/Sat.hs +8/−0
- Data/Geo/GPX/Accessor/Src.hs +8/−0
- Data/Geo/GPX/Accessor/Sym.hs +8/−0
- Data/Geo/GPX/Accessor/Text.hs +8/−0
- Data/Geo/GPX/Accessor/Trkpts.hs +7/−0
- Data/Geo/GPX/Accessor/Trks.hs +7/−0
- Data/Geo/GPX/Accessor/Trksegs.hs +7/−0
- Data/Geo/GPX/Accessor/Type.hs +8/−0
- Data/Geo/GPX/Accessor/Value.hs +5/−1
- Data/Geo/GPX/Accessor/Vdop.hs +8/−0
- Data/Geo/GPX/Accessor/Version.hs +5/−0
- Data/Geo/GPX/Accessor/Wpts.hs +7/−0
- Data/Geo/GPX/Accessor/Year.hs +8/−0
- Data/Geo/GPX/Gpx.hs +82/−1
- GPX.cabal +1/−1
Data/Geo/GPX/Accessor/Ageofdgpsdata.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Ageofdgpsdata where +import Data.Geo.GPX.Accessor.Accessor+ class Ageofdgpsdata a where ageofdgpsdata :: a -> Maybe Double setAgeofdgpsdata :: Maybe Double -> a -> a++ setAgeofdgpsdata' :: Double -> a -> a+ setAgeofdgpsdata' = setAgeofdgpsdata . Just++ usingAgeofdgpsdata :: a -> (Maybe Double -> Maybe Double) -> a+ usingAgeofdgpsdata = ageofdgpsdata `using` setAgeofdgpsdata
Data/Geo/GPX/Accessor/Author.hs view
@@ -2,6 +2,10 @@ module Data.Geo.GPX.Accessor.Author where +import Data.Geo.GPX.Accessor.Accessor+ class Author a b | a -> b where author :: a -> b setAuthor :: b -> a -> a+ updateAuthor :: a -> (b -> b) -> a+ updateAuthor = author `using` setAuthor
Data/Geo/GPX/Accessor/Bounds.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Bounds where import Data.Geo.GPX.BoundsType+import Data.Geo.GPX.Accessor.Accessor class Bounds a where bounds :: a -> Maybe BoundsType setBounds :: Maybe BoundsType -> a -> a++ setBounds' :: BoundsType -> a -> a+ setBounds' = setBounds . Just++ usingBounds :: a -> (Maybe BoundsType -> Maybe BoundsType) -> a+ usingBounds = bounds `using` setBounds
Data/Geo/GPX/Accessor/Cmt.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Cmt where +import Data.Geo.GPX.Accessor.Accessor+ class Cmt a where cmt :: a -> Maybe String setCmt :: Maybe String -> a -> a++ setCmt' :: String -> a -> a+ setCmt' = setCmt . Just++ usingCmt :: a -> (Maybe String -> Maybe String) -> a+ usingCmt = cmt `using` setCmt
Data/Geo/GPX/Accessor/Copyright.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Copyright where import Data.Geo.GPX.CopyrightType+import Data.Geo.GPX.Accessor.Accessor class Copyright a where copyright :: a -> Maybe CopyrightType setCopyright :: Maybe CopyrightType -> a -> a++ setCopyright' :: CopyrightType -> a -> a+ setCopyright' = setCopyright . Just++ usingCopyright :: a -> (Maybe CopyrightType -> Maybe CopyrightType) -> a+ usingCopyright = copyright `using` setCopyright
Data/Geo/GPX/Accessor/Creator.hs view
@@ -1,5 +1,10 @@ module Data.Geo.GPX.Accessor.Creator where +import Data.Geo.GPX.Accessor.Accessor+ class Creator a where creator :: a -> String setCreator :: String -> a -> a++ usingCreator :: a -> (String -> String) -> a+ usingCreator = creator `using` setCreator
Data/Geo/GPX/Accessor/Desc.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Desc where +import Data.Geo.GPX.Accessor.Accessor+ class Desc a where desc :: a -> Maybe String setDesc :: Maybe String -> a -> a++ setDesc' :: String -> a -> a+ setDesc' = setDesc . Just++ usingDesc :: a -> (Maybe String -> Maybe String) -> a+ usingDesc = desc `using` setDesc
Data/Geo/GPX/Accessor/Dgpsid.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Dgpsid where import Data.Geo.GPX.DgpsStationType+import Data.Geo.GPX.Accessor.Accessor class Dgpsid a where dgpsid :: a -> Maybe DgpsStationType setDgpsid :: Maybe DgpsStationType -> a -> a++ setDgpsid' :: DgpsStationType -> a -> a+ setDgpsid' = setDgpsid . Just++ usingDgpsid :: a -> (Maybe DgpsStationType -> Maybe DgpsStationType) -> a+ usingDgpsid = dgpsid `using` setDgpsid
Data/Geo/GPX/Accessor/Domain.hs view
@@ -1,5 +1,10 @@ module Data.Geo.GPX.Accessor.Domain where +import Data.Geo.GPX.Accessor.Accessor+ class Domain a where domain :: a -> String setDomain :: String -> a -> a++ usingDomain :: a -> (String -> String) -> a+ usingDomain = domain `using` setDomain
Data/Geo/GPX/Accessor/Ele.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Ele where +import Data.Geo.GPX.Accessor.Accessor+ class Ele a where ele :: a -> Maybe Double setEle :: Maybe Double -> a -> a++ setEle' :: Double -> a -> a+ setEle' = setEle . Just++ usingEle :: a -> (Maybe Double -> Maybe Double) -> a+ usingEle = ele `using` setEle
Data/Geo/GPX/Accessor/Email.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Email where import Data.Geo.GPX.EmailType+import Data.Geo.GPX.Accessor.Accessor class Email a where email :: a -> Maybe EmailType setEmail :: Maybe EmailType -> a -> a++ setEmail' :: EmailType -> a -> a+ setEmail' = setEmail . Just++ usingEmail :: a -> (Maybe EmailType -> Maybe EmailType) -> a+ usingEmail = email `using` setEmail
Data/Geo/GPX/Accessor/Extensions.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Extensions where import Data.Geo.GPX.ExtensionsType+import Data.Geo.GPX.Accessor.Accessor class Extensions a where extensions :: a -> Maybe ExtensionsType setExtensions :: Maybe ExtensionsType -> a -> a++ setExtensions' :: ExtensionsType -> a -> a+ setExtensions' = setExtensions . Just++ usingExtensions :: a -> (Maybe ExtensionsType -> Maybe ExtensionsType) -> a+ usingExtensions = extensions `using` setExtensions
Data/Geo/GPX/Accessor/Fix.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Fix where import Data.Geo.GPX.FixType+import Data.Geo.GPX.Accessor.Accessor class Fix a where fix :: a -> Maybe FixType setFix :: Maybe FixType -> a -> a++ setFix' :: FixType -> a -> a+ setFix' = setFix . Just++ usingFix :: a -> (Maybe FixType -> Maybe FixType) -> a+ usingFix = fix `using` setFix
Data/Geo/GPX/Accessor/Geoidheight.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Geoidheight where +import Data.Geo.GPX.Accessor.Accessor+ class Geoidheight a where geoidheight :: a -> Maybe Double setGeoidheight :: Maybe Double -> a -> a++ setGeoidheight' :: Double -> a -> a+ setGeoidheight' = setGeoidheight . Just++ usingGeoidheight :: a -> (Maybe Double -> Maybe Double) -> a+ usingGeoidheight = geoidheight `using` setGeoidheight
Data/Geo/GPX/Accessor/Hdop.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Hdop where +import Data.Geo.GPX.Accessor.Accessor+ class Hdop a where hdop :: a -> Maybe Double setHdop :: Maybe Double -> a -> a++ setHdop' :: Double -> a -> a+ setHdop' = setHdop . Just++ usingHdop :: a -> (Maybe Double -> Maybe Double) -> a+ usingHdop = hdop `using` setHdop
Data/Geo/GPX/Accessor/Href.hs view
@@ -1,5 +1,10 @@ module Data.Geo.GPX.Accessor.Href where +import Data.Geo.GPX.Accessor.Accessor+ class Href a where href :: a -> String setHref :: String -> a -> a++ usingHref :: a -> (String -> String) -> a+ usingHref = href `using` setHref
Data/Geo/GPX/Accessor/Id.hs view
@@ -1,5 +1,11 @@ module Data.Geo.GPX.Accessor.Id where +import Data.Geo.GPX.Accessor.Accessor+import Prelude hiding (id)+ class Id a where id :: a -> String setId :: String -> a -> a++ usingId :: a -> (String -> String) -> a+ usingId = id `using` setId
Data/Geo/GPX/Accessor/Keywords.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Keywords where +import Data.Geo.GPX.Accessor.Accessor+ class Keywords a where keywords :: a -> Maybe String setKeywords :: Maybe String -> a -> a++ setKeywords' :: String -> a -> a+ setKeywords' = setKeywords . Just++ usingKeywords :: a -> (Maybe String -> Maybe String) -> a+ usingKeywords = keywords `using` setKeywords
Data/Geo/GPX/Accessor/Lat.hs view
@@ -1,7 +1,11 @@ module Data.Geo.GPX.Accessor.Lat where import Data.Geo.GPX.LatitudeType+import Data.Geo.GPX.Accessor.Accessor class Lat a where lat :: a -> LatitudeType setLat :: LatitudeType -> a -> a++ usingLat :: a -> (LatitudeType -> LatitudeType) -> a+ usingLat = lat `using` setLat
Data/Geo/GPX/Accessor/Latlon.hs view
@@ -1,7 +1,11 @@ {-# LANGUAGE FlexibleContexts, FlexibleInstances, UndecidableInstances #-} module Data.Geo.GPX.Accessor.Latlon where+import Data.Geo.GPX.Accessor.Accessor class Latlon a where latlon :: a -> (Double, Double) setLatlon :: (Double, Double) -> a -> a++ usingLatlon :: a -> ((Double, Double) -> (Double, Double)) -> a+ usingLatlon = latlon `using` setLatlon
Data/Geo/GPX/Accessor/License.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.License where +import Data.Geo.GPX.Accessor.Accessor+ class License a where license :: a -> Maybe String setLicense :: Maybe String -> a -> a++ setLicense' :: String -> a -> a+ setLicense' = setLicense . Just++ usingLicense :: a -> (Maybe String -> Maybe String) -> a+ usingLicense = license `using` setLicense
Data/Geo/GPX/Accessor/Link.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Link where import Data.Geo.GPX.LinkType+import Data.Geo.GPX.Accessor.Accessor class Link a where link :: a -> Maybe LinkType setLink :: Maybe LinkType -> a -> a++ setLink' :: LinkType -> a -> a+ setLink' = setLink . Just++ usingLink :: a -> (Maybe LinkType -> Maybe LinkType) -> a+ usingLink = link `using` setLink
Data/Geo/GPX/Accessor/Links.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Links where import Data.Geo.GPX.LinkType+import Data.Geo.GPX.Accessor.Accessor class Links a where links :: a -> [LinkType] setLinks :: [LinkType] -> a -> a++ setLinks' :: LinkType -> a -> a+ setLinks' = setLinks . return++ usingLinks :: a -> ([LinkType] -> [LinkType]) -> a+ usingLinks = links `using` setLinks
Data/Geo/GPX/Accessor/Lon.hs view
@@ -1,7 +1,11 @@ module Data.Geo.GPX.Accessor.Lon where import Data.Geo.GPX.LongitudeType+import Data.Geo.GPX.Accessor.Accessor class Lon a where lon :: a -> LongitudeType setLon :: LongitudeType -> a -> a++ usingLon :: a -> (LongitudeType -> LongitudeType) -> a+ usingLon = lon `using` setLon
Data/Geo/GPX/Accessor/Magvar.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Magvar where import Data.Geo.GPX.DegreesType+import Data.Geo.GPX.Accessor.Accessor class Magvar a where magvar :: a -> Maybe DegreesType setMagvar :: Maybe DegreesType -> a -> a++ setMagvar' :: DegreesType -> a -> a+ setMagvar' = setMagvar . Just++ usingMagvar :: a -> (Maybe DegreesType -> Maybe DegreesType) -> a+ usingMagvar = magvar `using` setMagvar
Data/Geo/GPX/Accessor/Maxlat.hs view
@@ -1,7 +1,11 @@ module Data.Geo.GPX.Accessor.Maxlat where import Data.Geo.GPX.LatitudeType+import Data.Geo.GPX.Accessor.Accessor class Maxlat a where maxlat :: a -> LatitudeType setMaxlat :: LatitudeType -> a -> a++ usingMaxlat :: a -> (LatitudeType -> LatitudeType) -> a+ usingMaxlat = maxlat `using` setMaxlat
Data/Geo/GPX/Accessor/Maxlon.hs view
@@ -1,8 +1,11 @@ module Data.Geo.GPX.Accessor.Maxlon where import Data.Geo.GPX.LongitudeType+import Data.Geo.GPX.Accessor.Accessor class Maxlon a where maxlon :: a -> LongitudeType setMaxlon :: LongitudeType -> a -> a---++ usingMaxlon :: a -> (LongitudeType -> LongitudeType) -> a+ usingMaxlon = maxlon `using` setMaxlon
Data/Geo/GPX/Accessor/Metadata.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Metadata where import Data.Geo.GPX.MetadataType+import Data.Geo.GPX.Accessor.Accessor class Metadata a where metadata :: a -> Maybe MetadataType setMetadata :: Maybe MetadataType -> a -> a++ setMetadata' :: MetadataType -> a -> a+ setMetadata' = setMetadata . Just++ usingMetadata :: a -> (Maybe MetadataType -> Maybe MetadataType) -> a+ usingMetadata = metadata `using` setMetadata
Data/Geo/GPX/Accessor/Minlat.hs view
@@ -1,7 +1,11 @@ module Data.Geo.GPX.Accessor.Minlat where import Data.Geo.GPX.LatitudeType+import Data.Geo.GPX.Accessor.Accessor class Minlat a where minlat :: a -> LatitudeType setMinlat :: LatitudeType -> a -> a++ usingMinlat :: a -> (LatitudeType -> LatitudeType) -> a+ usingMinlat = minlat `using` setMinlat
Data/Geo/GPX/Accessor/Minlon.hs view
@@ -1,7 +1,11 @@ module Data.Geo.GPX.Accessor.Minlon where import Data.Geo.GPX.LongitudeType+import Data.Geo.GPX.Accessor.Accessor class Minlon a where minlon :: a -> LongitudeType setMinlon :: LongitudeType -> a -> a++ usingMinlon :: a -> (LongitudeType -> LongitudeType) -> a+ usingMinlon = minlon `using` setMinlon
Data/Geo/GPX/Accessor/Name.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Name where +import Data.Geo.GPX.Accessor.Accessor+ class Name a where name :: a -> Maybe String setName :: Maybe String -> a -> a++ setName' :: String -> a -> a+ setName' = setName . Just++ usingName :: a -> (Maybe String -> Maybe String) -> a+ usingName = name `using` setName
Data/Geo/GPX/Accessor/Number.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Number where +import Data.Geo.GPX.Accessor.Accessor+ class Number a where number :: a -> Maybe Int setNumber :: Maybe Int -> a -> a++ setNumber' :: Int -> a -> a+ setNumber' = setNumber . Just++ usingNumber :: a -> (Maybe Int -> Maybe Int) -> a+ usingNumber = number `using` setNumber
Data/Geo/GPX/Accessor/Pdop.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Pdop where +import Data.Geo.GPX.Accessor.Accessor+ class Pdop a where pdop :: a -> Maybe Double setPdop :: Maybe Double -> a -> a++ setPdop' :: Double -> a -> a+ setPdop' = setPdop . Just++ usingPdop :: a -> (Maybe Double -> Maybe Double) -> a+ usingPdop = pdop `using` setPdop
Data/Geo/GPX/Accessor/Pts.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Pts where import Data.Geo.GPX.PtType+import Data.Geo.GPX.Accessor.Accessor class Pts a where pts :: a -> [PtType] setPts :: [PtType] -> a -> a++ setPts' :: PtType -> a -> a+ setPts' = setPts . return++ usingPts :: a -> ([PtType] -> [PtType]) -> a+ usingPts = pts `using` setPts
Data/Geo/GPX/Accessor/Rtepts.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Rtepts where import Data.Geo.GPX.WptType+import Data.Geo.GPX.Accessor.Accessor class Rtepts a where rtepts :: a -> [WptType] setRtepts :: [WptType] -> a -> a++ setRtepts' :: WptType -> a -> a+ setRtepts' = setRtepts . return++ usingRtepts :: a -> ([WptType] -> [WptType]) -> a+ usingRtepts = rtepts `using` setRtepts
Data/Geo/GPX/Accessor/Rtes.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Rtes where import Data.Geo.GPX.RteType+import Data.Geo.GPX.Accessor.Accessor class Rtes a where rtes :: a -> [RteType] setRtes :: [RteType] -> a -> a++ setRtes' :: RteType -> a -> a+ setRtes' = setRtes . return++ usingRtes :: a -> ([RteType] -> [RteType]) -> a+ usingRtes = rtes `using` setRtes
Data/Geo/GPX/Accessor/Sat.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Sat where +import Data.Geo.GPX.Accessor.Accessor+ class Sat a where sat :: a -> Maybe Int setSat :: Maybe Int -> a -> a++ setSat' :: Int -> a -> a+ setSat' = setSat . Just++ usingSat :: a -> (Maybe Int -> Maybe Int) -> a+ usingSat = sat `using` setSat
Data/Geo/GPX/Accessor/Src.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Src where +import Data.Geo.GPX.Accessor.Accessor+ class Src a where src :: a -> Maybe String setSrc :: Maybe String -> a -> a++ setSrc' :: String -> a -> a+ setSrc' = setSrc . Just++ usingSrc :: a -> (Maybe String -> Maybe String) -> a+ usingSrc = src `using` setSrc
Data/Geo/GPX/Accessor/Sym.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Sym where +import Data.Geo.GPX.Accessor.Accessor+ class Sym a where sym :: a -> Maybe String setSym :: Maybe String -> a -> a++ setSym' :: String -> a -> a+ setSym' = setSym . Just++ usingSym :: a -> (Maybe String -> Maybe String) -> a+ usingSym = sym `using` setSym
Data/Geo/GPX/Accessor/Text.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Text where +import Data.Geo.GPX.Accessor.Accessor+ class Text a where text :: a -> Maybe String setText :: Maybe String -> a -> a++ setText' :: String -> a -> a+ setText' = setText . Just++ usingText :: a -> (Maybe String -> Maybe String) -> a+ usingText = text `using` setText
Data/Geo/GPX/Accessor/Trkpts.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Trkpts where import Data.Geo.GPX.WptType+import Data.Geo.GPX.Accessor.Accessor class Trkpts a where trkpts :: a -> [WptType] setTrkpts :: [WptType] -> a -> a++ setTrkpts' :: WptType -> a -> a+ setTrkpts' = setTrkpts . return++ usingTrkpts :: a -> ([WptType] -> [WptType]) -> a+ usingTrkpts = trkpts `using` setTrkpts
Data/Geo/GPX/Accessor/Trks.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Trks where import Data.Geo.GPX.TrkType+import Data.Geo.GPX.Accessor.Accessor class Trks a where trks :: a -> [TrkType] setTrks :: [TrkType] -> a -> a++ setTrks' :: TrkType -> a -> a+ setTrks' = setTrks . return++ usingTrks :: a -> ([TrkType] -> [TrkType]) -> a+ usingTrks = trks `using` setTrks
Data/Geo/GPX/Accessor/Trksegs.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Trksegs where import Data.Geo.GPX.TrksegType+import Data.Geo.GPX.Accessor.Accessor class Trksegs a where trksegs :: a -> [TrksegType] setTrksegs :: [TrksegType] -> a -> a++ setTrksegs' :: TrksegType -> a -> a+ setTrksegs' = setTrksegs . return++ usingTrksegs :: a -> ([TrksegType] -> [TrksegType]) -> a+ usingTrksegs = trksegs `using` setTrksegs
Data/Geo/GPX/Accessor/Type.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Type where +import Data.Geo.GPX.Accessor.Accessor+ class Type a where type' :: a -> Maybe String setType :: Maybe String -> a -> a++ setType' :: String -> a -> a+ setType' = setType . Just++ usingType :: a -> (Maybe String -> Maybe String) -> a+ usingType = type' `using` setType
Data/Geo/GPX/Accessor/Value.hs view
@@ -1,7 +1,11 @@ {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}- module Data.Geo.GPX.Accessor.Value where +import Data.Geo.GPX.Accessor.Accessor+ class Value a b | a -> b where value :: a -> b setValue :: b -> a -> a++ usingValue :: a -> (b -> b) -> a+ usingValue = value `using` setValue
Data/Geo/GPX/Accessor/Vdop.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Vdop where +import Data.Geo.GPX.Accessor.Accessor+ class Vdop a where vdop :: a -> Maybe Double setVdop :: Maybe Double -> a -> a++ setVdop' :: Double -> a -> a+ setVdop' = setVdop . Just++ usingVdop :: a -> (Maybe Double -> Maybe Double) -> a+ usingVdop = vdop `using` setVdop
Data/Geo/GPX/Accessor/Version.hs view
@@ -1,5 +1,10 @@ module Data.Geo.GPX.Accessor.Version where +import Data.Geo.GPX.Accessor.Accessor+ class Version a where version :: a -> String setVersion :: String -> a -> a++ usingVersion :: a -> (String -> String) -> a+ usingVersion = version `using` setVersion
Data/Geo/GPX/Accessor/Wpts.hs view
@@ -1,7 +1,14 @@ module Data.Geo.GPX.Accessor.Wpts where import Data.Geo.GPX.WptType+import Data.Geo.GPX.Accessor.Accessor class Wpts a where wpts :: a -> [WptType] setWpts :: [WptType] -> a -> a++ setWpts' :: WptType -> a -> a+ setWpts' = setWpts . return++ usingWpts :: a -> ([WptType] -> [WptType]) -> a+ usingWpts = wpts `using` setWpts
Data/Geo/GPX/Accessor/Year.hs view
@@ -1,5 +1,13 @@ module Data.Geo.GPX.Accessor.Year where +import Data.Geo.GPX.Accessor.Accessor+ class Year a where year :: a -> Maybe String setYear :: Maybe String -> a -> a++ setYear' :: String -> a -> a+ setYear' = setYear . Just++ usingYear :: a -> (Maybe String -> Maybe String) -> a+ usingYear = year `using` setYear
Data/Geo/GPX/Gpx.hs view
@@ -5,11 +5,20 @@ Gpx, gpx, readGpxFile,- readGpxFiles+ readGpxFiles,+ interactGpxIO,+ interactsGpxIO,+ interactGpxIO',+ interactsGpxIO',+ interactGpx,+ interactsGpx,+ interactGpx',+ interactsGpx' ) where import Text.XML.HXT.Arrow import Control.Monad+import Data.List import Data.Geo.GPX.GpxType import Data.Geo.GPX.PersonType import Data.Geo.GPX.Accessor.Value@@ -59,3 +68,75 @@ -- | Reads 0 or more GPX files into a list of @Gpx@ values removing whitespace. readGpxFiles :: [FilePath] -> IO [Gpx] readGpxFiles = fmap join . (mapM readGpxFile)++-- | Reads a GPX file, executes the given function on the XML, then writes the given file.+interactGpxIO' :: Attributes -- ^ The options for reading the GPX file.+ -> FilePath -- ^ The GPX file to read.+ -> (Gpx -> IO Gpx) -- ^ The function to execute on the XML that is read.+ -> Attributes -- ^ The options for writing the GPX file.+ -> FilePath -- ^ The GPX file to write.+ -> IO ()+interactGpxIO' froma from f toa to = runX (xunpickleDocument (xpickle :: PU Gpx) froma from >>> arrIO f >>> xpickleDocument (xpickle :: PU Gpx) toa to) >> return ()++-- | Reads a GPX file, executes the given functions on the XML, then writes the given file.+interactsGpxIO' :: Attributes -- ^ The options for reading the GPX file.+ -> FilePath -- ^ The GPX file to read.+ -> [Gpx -> IO Gpx] -- ^ The function to execute on the XML that is read.+ -> Attributes -- ^ The options for writing the GPX file.+ -> FilePath -- ^ The GPX file to write.+ -> IO ()+interactsGpxIO' froma from = interactGpxIO' froma from . sumIO'++-- | Reads a GPX file removing whitespace, executes the given function on the XML, then writes the given file with indentation.+interactGpxIO :: FilePath -- ^ The GPX file to read.+ -> (Gpx -> IO Gpx) -- ^ The function to execute on the XML that is read.+ -> FilePath -- ^ The GPX file to write.+ -> IO ()+interactGpxIO from f = interactGpxIO' [(a_remove_whitespace, v_1)] from f [(a_indent, v_1)]++-- | Reads a GPX file removing whitespace, executes the given functions on the XML, then writes the given file with indentation.+interactsGpxIO :: FilePath -- ^ The GPX file to read.+ -> [Gpx -> IO Gpx] -- ^ The function to execute on the XML that is read.+ -> FilePath -- ^ The GPX file to write.+ -> IO ()+interactsGpxIO from = interactGpxIO from . sumIO'++-- | Reads a GPX file, executes the given function on the XML, then writes the given file.+interactGpx' :: Attributes -- ^ The options for reading the GPX file.+ -> FilePath -- ^ The GPX file to read.+ -> (Gpx -> Gpx) -- ^ The function to execute on the XML that is read.+ -> Attributes -- ^ The options for writing the GPX file.+ -> FilePath -- ^ The GPX file to write.+ -> IO ()+interactGpx' froma from f = interactGpxIO' froma from (return . f)++-- | Reads a GPX file, executes the given functions on the XML, then writes the given file.+interactsGpx' :: Attributes -- ^ The options for reading the GPX file.+ -> FilePath -- ^ The GPX file to read.+ -> [Gpx -> Gpx] -- ^ The functions to execute on the XML that is read.+ -> Attributes -- ^ The options for writing the GPX file.+ -> FilePath -- ^ The GPX file to write.+ -> IO ()+interactsGpx' froma from = interactGpx' froma from . sum'++-- | Reads a GPX file removing whitespace, executes the given function on the XML, then writes the given file with indentation.+interactGpx :: FilePath -- ^ The GPX file to read.+ -> (Gpx -> Gpx) -- ^ The function to execute on the XML that is read.+ -> FilePath -- ^ The GPX file to write.+ -> IO ()+interactGpx from f = interactGpxIO from (return . f)++-- | Reads a GPX file removing whitespace, executes the given functions on the XML, then writes the given file with indentation.+interactsGpx :: FilePath -- ^ The GPX file to read.+ -> [Gpx -> Gpx] -- ^ The function to execute on the XML that is read.+ -> FilePath -- ^ The GPX file to write.+ -> IO ()+interactsGpx from = interactGpx from . sum'++-- not exported++sum' :: [a -> a] -> a -> a+sum' = foldl' (.) id++sumIO' :: (Monad m) => [a -> m a] -> a -> m a+sumIO' x = foldl' (>=>) return x
GPX.cabal view
@@ -1,5 +1,5 @@ Name: GPX-Version: 0.4.1+Version: 0.4.2 License: BSD3 License-File: LICENSE Synopsis: Parse GPX files