{-# LANGUAGE MultiParamTypeClasses, TypeSynonymInstances, FlexibleInstances #-}-- | The @osm@ element of a OSM file, which is the root element. <http://wiki.openstreetmap.org/wiki/API_v0.6/DTD>moduleData.Geo.OSM.OSM(OSM,osm,readOsmFile,readOsmFiles,interactOSMIO,interactsOSMIO,interactOSMIO',interactsOSMIO',interactOSM,interactsOSM,interactOSM',interactsOSM')whereimportPreludehiding(mapM,foldr)importText.XML.HXT.CoreimportControl.Monadhiding(mapM)importData.FoldableimportData.TraversableimportData.Geo.OSM.ChildrenimportData.Geo.OSM.BoundimportData.Geo.OSM.BoundsimportData.Geo.OSM.BoundOptionimportData.Lens.CommonimportControl.Comonad.Trans.StoreimportData.Geo.OSM.Lens.VersionLimportData.Geo.OSM.Lens.GeneratorLimportData.Geo.OSM.Lens.BoundsLimportData.Geo.OSM.Lens.ChildrenLimportData.Monoid-- | The @osm@ element of a OSM file, which is the root element.dataOSM=OSMString(MaybeString)(Maybe(EitherBoundBounds))ChildrenderivingEqinstanceXmlPicklerOSMwherexpickle=xpElem"osm"(xpWrap(\(version',generator',bound',nwr')->osmversion'generator'bound'nwr',\(OSMversion'generator'bound'nwr')->(version',generator',bound',nwr'))(xp4Tuple(xpAttr"version"xpText)(xpOption(xpAttr"generator"xpText))(xpOption(xpAlt(either(const0)(const1))[xpWrap(Left,\(Leftb)->b)xpickle,xpWrap(Right,\(Rightb)->b)xpickle]))xpickle))instanceShowOSMwhereshow=showPickled[]instanceVersionLOSMStringwhereversionL=Lens$\(OSMversiongeneratorboundschildren)->store(\version->OSMversiongeneratorboundschildren)versioninstanceBoundsLOSMwhereboundsL=Lens$\(OSMversiongeneratorboundschildren)->store(\bounds->OSMversiongenerator(foldBoundOption(Just.Left)(Just.Right)Nothingbounds)children)$caseboundsofNothing->optionEmptyBoundJust(Leftb)->optionBoundbJust(Rightb)->optionBoundsbinstanceGeneratorLOSMwheregeneratorL=Lens$\(OSMversiongeneratorboundschildren)->store(\generator->OSMversiongeneratorboundschildren)generatorinstanceChildrenLOSMwherechildrenL=Lens$\(OSMversiongeneratorboundschildren)->store(\children->OSMversiongeneratorboundschildren)children-- | Constructs a osm with a version, bound or bounds, and node attributes and way or relation elements.osm::String-- ^ The @version@ attribute.->MaybeString-- ^ The @generator@ attribute.->Maybe(EitherBoundBounds)-- ^ The @bound@ or @bounds@ elements.->Children-- ^ The child elements.->OSMosm=OSM-- | Reads an OSM file into a list of @OSM@ values removing whitespace.readOsmFile::FilePath->IO[OSM]readOsmFile=runX.xunpickleDocument(xpickle::PUOSM)([withRemoveWSyes,withFileMimeTypev_1])-- FIXME v_1?-- | Reads 0 or more OSM files into a list of @OSM@ values removing whitespace.readOsmFiles::[FilePath]->IO[OSM]readOsmFiles=fmapjoin.mapMreadOsmFile-- | Reads a OSM file, executes the given function on the XML, then writes the given file.interactOSMIO'::(OSM->IOOSM)-- ^ 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'ffromafromtoato=runX(xunpickleDocument(xpickle::PUOSM)fromafrom>>>arrIOf>>>xpickleDocument(xpickle::PUOSM)toato)>>return()-- | Reads a OSM file, executes the given functions on the XML, then writes the given file.interactsOSMIO'::Foldablet=>t(OSM->IOOSM)-- ^ 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->IOOSM)-- ^ The function to execute on the XML that is read.->FilePath-- ^ The OSM file to read.->FilePath-- ^ The OSM file to write.->IO()interactOSMIOffrom=interactOSMIO'f[withRemoveWSyes,withFileMimeTypev_1]from[withIndentyes,withFileMimeTypev_1]-- | Reads a OSM file removing whitespace, executes the given functions on the XML, then writes the given file with indentation.interactsOSMIO::Foldablet=>t(OSM->IOOSM)-- ^ 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'::Foldablet=>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()interactOSMf=interactOSMIO(return.f)-- | Reads a OSM file removing whitespace, executes the given functions on the XML, then writes the given file with indentation.interactsOSM::Foldablet=>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 exportedsum'::Foldablet=>t(a->a)->a->asum'=appEndo.foldMapEndosumM::(Monadm,Foldablet)=>t(a->ma)->a->masumM=foldr(>=>)return