module Data.Geo.OSM.MemberType(
MemberType,
foldMemberType,
wayType,
nodeType,
relationType
) where
import Text.XML.HXT.Arrow
import Text.XML.HXT.Extras
import Data.Char
data MemberType = WayType | NodeType | RelationType
deriving Eq
foldMemberType :: MemberType
-> x
-> x
-> x
-> 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 []
wayType :: MemberType
wayType = WayType
nodeType :: MemberType
nodeType = NodeType
relationType :: MemberType
relationType = RelationType