HaXmlSource codeContentsIndex
Text.XML.HaXml.DtdToHaskell.TypeDef
Contents
Internal representation of types
Pretty-print a TypeDef
Name mangling
Description
Defines an internal representation of Haskell data/newtype definitions that correspond to the XML DTD types, and provides pretty-printers to convert these types into the Doc type of Text.PrettyPrint.HughesPJ.
Synopsis
data TypeDef
= DataDef Bool Name AttrFields Constructors
| EnumDef Name [Name]
type Constructors = [(Name, [StructType])]
type AttrFields = [(Name, StructType)]
data StructType
= Maybe StructType
| Defaultable StructType String
| List StructType
| List1 StructType
| Tuple [StructType]
| OneOf [StructType]
| Any
| StringMixed
| String
| Defined Name
ppTypeDef :: TypeDef -> Doc
ppHName :: Name -> Doc
ppXName :: Name -> Doc
ppAName :: Name -> Doc
data Name = Name {
xName :: String
hName :: String
}
name :: String -> Name
name_ :: String -> Name
name_a :: String -> String -> Name
name_ac :: String -> String -> String -> Name
name_f :: String -> String -> Name
mangle :: String -> String
manglef :: String -> String
Internal representation of types
data TypeDef Source
Constructors
DataDef Bool Name AttrFields ConstructorsBool for main/aux.
EnumDef Name [Name]
show/hide Instances
type Constructors = [(Name, [StructType])]Source
type AttrFields = [(Name, StructType)]Source
data StructType Source
Constructors
Maybe StructType
Defaultable StructType StringString holds default value.
List StructType
List1 StructTypeNon-empty lists.
Tuple [StructType]
OneOf [StructType]
AnyXML's contentspec allows ANY
StringMixedmixed (#PCDATA | ... )*
Stringstring only (#PCDATA)
Defined Name
show/hide Instances
Pretty-print a TypeDef
ppTypeDef :: TypeDef -> DocSource
ppHName :: Name -> DocSource
Pretty print Haskell name.
ppXName :: Name -> DocSource
Pretty print XML name.
ppAName :: Name -> DocSource
Pretty print Haskell attributes name.
Name mangling
data Name Source
Need to keep both the XML and Haskell versions of a name.
Constructors
Name
xName :: Stringoriginal XML name
hName :: Stringmangled Haskell name
show/hide Instances
Eq Name
name :: String -> NameSource
Make a type name valid in both XML and Haskell.
name_ :: String -> NameSource
Append an underscore to the Haskell version of the name.
name_a :: String -> String -> NameSource
Prefix an attribute enumeration type name with its containing element name.
name_ac :: String -> String -> String -> NameSource
Prefix an attribute enumeration constructor with its element-tag name, and its enumeration type name.
name_f :: String -> String -> NameSource
Prefix a field name with its enclosing element name.
mangle :: String -> StringSource
Convert an XML name to a Haskell conid.
manglef :: String -> StringSource
Convert an XML name to a Haskell varid.
Produced by Haddock version 2.4.2