{-# LANGUAGE MultiParamTypeClasses, TypeSynonymInstances #-}-- | 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')whereimportText.XML.HXT.ArrowimportText.XML.HXT.ExtrasimportControl.MonadimportData.ListimportData.Geo.OSM.OSMChildrenimportData.Geo.OSM.BoundimportData.Geo.OSM.BoundsimportData.Geo.OSM.Accessor.VersionimportData.Geo.OSM.Accessor.GeneratorimportData.Geo.OSM.Accessor.BoundOrsimportData.Geo.OSM.Accessor.NodeWayRelations-- | The @osm@ element of a OSM file, which is the root element.dataOSM=OSMString(MaybeString)(Maybe(EitherBoundBounds))OSMChildrenderivingEqinstanceXmlPicklerOSMwherexpickle=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[]instanceVersionOSMStringwhereversion(OSMx___)=xsetVersiona(OSM_bcd)=osmabcdinstanceGeneratorOSMwheregenerator(OSM_x__)=xsetGeneratorb(OSMa_cd)=osmabcdinstanceBoundOrsOSMwhereboundOrs(OSM__x_)nbbs=casexofNothing->nJust(Leftb')->bb'Just(Rightb')->bsb'setBoundOrsc(OSMab_d)=osmabcdinstanceNodeWayRelationsOSMwherenwrs(OSM___x)=lett=const[]infoldOSMChildrentttttidxsetNwrsd(OSMabc_)=osmabc(osmNodeWayRelationd)-- | 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.->OSMChildren-- ^ 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)[(a_remove_whitespace,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'::Attributes-- ^ The options for reading the OSM file.->FilePath-- ^ The OSM file to read.->(OSM->IOOSM)-- ^ The function to execute on the XML that is read.->Attributes-- ^ The options for writing the OSM file.->FilePath-- ^ The OSM file to write.->IO()interactOSMIO'fromafromftoato=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'::Attributes-- ^ The options for reading the OSM file.->FilePath-- ^ The OSM file to read.->[OSM->IOOSM]-- ^ The function to execute on the XML that is read.->Attributes-- ^ The options for writing the OSM file.->FilePath-- ^ The OSM file to write.->IO()interactsOSMIO'fromafrom=interactOSMIO'fromafrom.sumIO'-- | Reads a OSM file removing whitespace, executes the given function on the XML, then writes the given file with indentation.interactOSMIO::FilePath-- ^ The OSM file to read.->(OSM->IOOSM)-- ^ The function to execute on the XML that is read.->FilePath-- ^ The OSM file to write.->IO()interactOSMIOfromf=interactOSMIO'[(a_remove_whitespace,v_1)]fromf[(a_indent,v_1)]-- | Reads a OSM file removing whitespace, executes the given functions on the XML, then writes the given file with indentation.interactsOSMIO::FilePath-- ^ The OSM file to read.->[OSM->IOOSM]-- ^ The function to execute on the XML that is read.->FilePath-- ^ The OSM file to write.->IO()interactsOSMIOfrom=interactOSMIOfrom.sumIO'-- | Reads a OSM file, executes the given function on the XML, then writes the given file.interactOSM'::Attributes-- ^ The options for reading the OSM file.->FilePath-- ^ The OSM file to read.->(OSM->OSM)-- ^ The function to execute on the XML that is read.->Attributes-- ^ The options for writing the OSM file.->FilePath-- ^ The OSM file to write.->IO()interactOSM'fromafromf=interactOSMIO'fromafrom(return.f)-- | Reads a OSM file, executes the given functions on the XML, then writes the given file.interactsOSM'::Attributes-- ^ The options for reading the OSM file.->FilePath-- ^ The OSM file to read.->[OSM->OSM]-- ^ The functions to execute on the XML that is read.->Attributes-- ^ The options for writing the OSM file.->FilePath-- ^ The OSM file to write.->IO()interactsOSM'fromafrom=interactOSM'fromafrom.sum'-- | Reads a OSM file removing whitespace, executes the given function on the XML, then writes the given file with indentation.interactOSM::FilePath-- ^ The OSM file to read.->(OSM->OSM)-- ^ The function to execute on the XML that is read.->FilePath-- ^ The OSM file to write.->IO()interactOSMfromf=interactOSMIOfrom(return.f)-- | Reads a OSM file removing whitespace, executes the given functions on the XML, then writes the given file with indentation.interactsOSM::FilePath-- ^ The OSM file to read.->[OSM->OSM]-- ^ The function to execute on the XML that is read.->FilePath-- ^ The OSM file to write.->IO()interactsOSMfrom=interactOSMfrom.sum'-- not exportedsum'::[a->a]->a->asum'=foldl'(.)idsumIO'::(Monadm)=>[a->ma]->a->masumIO'x=foldl'(>=>)returnx