MkOneOf(1)

MkOneOf1

A helper program to use with dtdtohaskell

Usage

MkOneOf n [m]

Overview

DtdToHaskell translates XML DTD into equivalent Haskell types. When there is a choice between different tags, DtdToHaskell uses types like OneOf2, OneOf3, OneOf4, etc. The module Text.XML.HaXml.OneOfN currently defines these types up OneOf20. If your DTD requires larger choices, you can use this program to generate them.

MkOneOf takes an integer N or an integer range N M and writes to the standard output a Haskell module with respectively the datatype OneOfN or the datatypes OneOfN up to and including OneOfM.

Examples

If we run "MkOneOf 1 2", the program will print

module Text.XML.HaXml.OneOfN where
import Text.XML.HaXml.Xml2Haskell
data OneOf1 a
    = OneOf1 a
    deriving (Eq,Show)
instance (XmlContent a)
    => XmlContent (OneOf1 a)
  where
    fromElem cs =
        (choice OneOf1
        $ (->(Nothing,c))) cs
    toElem (OneOf1 x) = toElem x
----
data OneOf2 a b
    = OneOf2 a | TwoOf2 b
    deriving (Eq,Show)
instance (XmlContent a,XmlContent b)
    => XmlContent (OneOf2 a b)
  where
    fromElem cs =
        (choice OneOf2 $ choice TwoOf2
        $ (->(Nothing,c))) cs
    toElem (OneOf2 x) = toElem x
    toElem (TwoOf2 x) = toElem x
----

Releases

10 releases since Debian 4.0 (Etch); the text changed 3 times.

  1. 4.0
  2. 5.0
  3. 6.0–8
  4. 9–13

Author

This contents of this manual page was copied from the HTML documentation and slightly edited by Arjan Oosting <[email protected]> for the Debian system (but may be used by others).

From haxml 1:1.25.13-2+b1 in Debian 13 (Trixie). Parsed by carta from the page's man source.