~singpolyma/xml-types-haskell

bf051b2d497df090ea404d60a2cda5f765506661 — John Millikin 11 years ago e7c9e95
Removed mostly useless ``Named`` class
2 files changed, 3 insertions(+), 13 deletions(-)

M Data/XML/Types.hs
M xml-types.cabal
M Data/XML/Types.hs => Data/XML/Types.hs +2 -12
@@ 35,7 35,6 @@ module Data.XML.Types
	, Attribute (..)
	, Content (..)
	, Name (..)
	, Named (..)
	
	-- ** Doctypes
	, Doctype (..)


@@ 143,15 142,6 @@ instance IsString Name where
		(ns, local) -> Name (T.pack (drop 1 local)) (Just (T.pack ns)) Nothing
	fromString local = Name (T.pack local) Nothing Nothing

class Named a where
	getName :: a -> Name

instance Named Element where
	getName = elementName

instance Named Attribute where
	getName = attributeName

data Doctype = Doctype
	{ doctypeName :: Text
	, doctypeExternalID :: Maybe ExternalID


@@ 204,8 194,8 @@ isComment :: Node -> [Text]
isComment (NodeComment t) = [t]
isComment _ = []

isNamed :: Named a => Name -> a -> [a]
isNamed n x = [x | getName x == n]
isNamed :: Name -> Element -> [Element]
isNamed n e = [e | elementName e == n]

elementChildren :: Element -> [Element]
elementChildren = elementNodes >=> isElement

M xml-types.cabal => xml-types.cabal +1 -1
@@ 1,5 1,5 @@
name: xml-types
version: 0.1.4
version: 0.2
synopsis: Basic types for representing XML
license: MIT
license-file: license.txt