Text.XML.HaXml.TypeMapping

HaXml-1.25.5: Utilities for manipulating XML documents

Safe Haskell | Safe
Language | Haskell98

Text.XML.HaXml.TypeMapping

Contents

- A class to get an explicit type representation for any value
- Explicit representation of Haskell datatype information
- Helper functions to extract type info as strings
- Conversion from Haskell datatype to DTD

Synopsis

- class HTypeable a where
  - toHType :: a -> HType
- data HType
  - = Maybe HType
  - | List HType
  - | Tuple [HType]
  - | Prim String String
  - | String
  - | Defined String [HType] [Constr]
- data Constr = Constr String [HType] [HType]
- showHType :: HType -> ShowS
- showConstr :: Int -> HType -> String
- toDTD :: HType -> DocTypeDecl

# A class to get an explicit type representation for any value

class HTypeable a where #

`HTypeable` promises that we can create an explicit representation of of the type of any value.

Methods

toHType :: a -> HType #

Instances

HTypeable Bool # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: Bool -> HType #
HTypeable Char # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: Char -> HType #
HTypeable Double # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: Double -> HType #
HTypeable Float # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: Float -> HType #
HTypeable Int # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: Int -> HType #
HTypeable Integer # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: Integer -> HType #
HTypeable () # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: () -> HType #
HTypeable ANYContent # |
Instance details Defined in Text.XML.HaXml.XmlContent.Parser Methods toHType :: ANYContent -> HType #
HTypeable a => HTypeable [a] # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: [a] -> HType #
HTypeable a => HTypeable (Maybe a) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: Maybe a -> HType #
HTypeable a => HTypeable (List1 a) # |
Instance details Defined in Text.XML.HaXml.XmlContent.Parser Methods toHType :: List1 a -> HType #
HTypeable a => HTypeable (OneOf1 a) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf1 a -> HType #
(HTypeable a, HTypeable b) => HTypeable (Either a b) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: Either a b -> HType #
(HTypeable a, HTypeable b) => HTypeable (a, b) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b) -> HType #
(HTypeable a, HTypeable b) => HTypeable (OneOf2 a b) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf2 a b -> HType #
(HTypeable a, HTypeable b, HTypeable c) => HTypeable (a, b, c) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c) -> HType #
(HTypeable a, HTypeable b, HTypeable c) => HTypeable (OneOf3 a b c) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf3 a b c -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d) => HTypeable (a, b, c, d) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c, d) -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d) => HTypeable (OneOf4 a b c d) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf4 a b c d -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e) => HTypeable (a, b, c, d, e) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c, d, e) -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e) => HTypeable (OneOf5 a b c d e) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf5 a b c d e -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f) => HTypeable (a, b, c, d, e, f) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c, d, e, f) -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f) => HTypeable (OneOf6 a b c d e f) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf6 a b c d e f -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g) => HTypeable (a, b, c, d, e, f, g) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c, d, e, f, g) -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g) => HTypeable (OneOf7 a b c d e f g) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf7 a b c d e f g -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h) => HTypeable (a, b, c, d, e, f, g, h) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c, d, e, f, g, h) -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h) => HTypeable (OneOf8 a b c d e f g h) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf8 a b c d e f g h -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i) => HTypeable (a, b, c, d, e, f, g, h, i) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c, d, e, f, g, h, i) -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i) => HTypeable (OneOf9 a b c d e f g h i) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf9 a b c d e f g h i -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j) => HTypeable (a, b, c, d, e, f, g, h, i, j) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c, d, e, f, g, h, i, j) -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j) => HTypeable (OneOf10 a b c d e f g h i j) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf10 a b c d e f g h i j -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k) => HTypeable (a, b, c, d, e, f, g, h, i, j, k) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c, d, e, f, g, h, i, j, k) -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k) => HTypeable (OneOf11 a b c d e f g h i j k) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf11 a b c d e f g h i j k -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l) => HTypeable (a, b, c, d, e, f, g, h, i, j, k, l) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c, d, e, f, g, h, i, j, k, l) -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l) => HTypeable (OneOf12 a b c d e f g h i j k l) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf12 a b c d e f g h i j k l -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m) => HTypeable (a, b, c, d, e, f, g, h, i, j, k, l, m) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m) => HTypeable (OneOf13 a b c d e f g h i j k l m) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf13 a b c d e f g h i j k l m -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n) => HTypeable (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n) => HTypeable (OneOf14 a b c d e f g h i j k l m n) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf14 a b c d e f g h i j k l m n -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o) => HTypeable (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods toHType :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o) => HTypeable (OneOf15 a b c d e f g h i j k l m n o) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf15 a b c d e f g h i j k l m n o -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o, HTypeable p) => HTypeable (OneOf16 a b c d e f g h i j k l m n o p) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf16 a b c d e f g h i j k l m n o p -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o, HTypeable p, HTypeable q) => HTypeable (OneOf17 a b c d e f g h i j k l m n o p q) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf17 a b c d e f g h i j k l m n o p q -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o, HTypeable p, HTypeable q, HTypeable r) => HTypeable (OneOf18 a b c d e f g h i j k l m n o p q r) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf18 a b c d e f g h i j k l m n o p q r -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o, HTypeable p, HTypeable q, HTypeable r, HTypeable s) => HTypeable (OneOf19 a b c d e f g h i j k l m n o p q r s) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf19 a b c d e f g h i j k l m n o p q r s -> HType #
(HTypeable a, HTypeable b, HTypeable c, HTypeable d, HTypeable e, HTypeable f, HTypeable g, HTypeable h, HTypeable i, HTypeable j, HTypeable k, HTypeable l, HTypeable m, HTypeable n, HTypeable o, HTypeable p, HTypeable q, HTypeable r, HTypeable s, HTypeable t) => HTypeable (OneOf20 a b c d e f g h i j k l m n o p q r s t) # |
Instance details Defined in Text.XML.HaXml.OneOfN Methods toHType :: OneOf20 a b c d e f g h i j k l m n o p q r s t -> HType #

# Explicit representation of Haskell datatype information

data HType #

A concrete representation of any Haskell type.

Constructors

Maybe HType |
List HType |
Tuple [HType] |
Prim String String | separate Haskell name and XML name
String |
Defined String [HType] [Constr] | A user-defined type has a name, a sequence of type variables, and a set of constructors. (The variables might already be instantiated to actual types.)

Instances

Eq HType # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods (==) :: HType -> HType -> Bool # (/=) :: HType -> HType -> Bool #
Show HType # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods showsPrec :: Int -> HType -> ShowS # show :: HType -> String # showList :: [HType] -> ShowS #

data Constr #

A concrete representation of any user-defined Haskell constructor. The constructor has a name, and a sequence of component types. The first sequence of types represents the minimum set of free type variables occurring in the (second) list of real component types. If there are fieldnames, they are contained in the final list, and correspond one-to-one with the component types.

Constructors

Constr String [HType] [HType] |

Instances

Eq Constr # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods (==) :: Constr -> Constr -> Bool # (/=) :: Constr -> Constr -> Bool #
Show Constr # |
Instance details Defined in Text.XML.HaXml.TypeMapping Methods showsPrec :: Int -> Constr -> ShowS # show :: Constr -> String # showList :: [Constr] -> ShowS #

# Helper functions to extract type info as strings

showHType :: HType -> ShowS #

showConstr :: Int -> HType -> String #

Project the n'th constructor from an HType and convert it to a string suitable for an XML tagname.

# Conversion from Haskell datatype to DTD

toDTD :: HType -> DocTypeDecl #

`toDTD` converts a concrete representation of the Haskell type of a value (obtained by the method `toHType`) into a real DocTypeDecl. It ensures that PERefs are defined before they are used, and that no element or attribute-list is declared more than once.