logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

MkOneOf - a helper program to use with DtdToHaskell

Author

       This  contents  of  this  manual page was copied from the HTML documentation and slightly edited by Arjan
       Oosting <arjan@debian.org> for the Debian system (but may be used by others).

MkOneOf, version 1.17                             October 2007                                        MkOneOf(1)

Description

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 NM 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
               $ (    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
               $ (    toElem (OneOf2 x) = toElem x
           toElem (TwoOf2 x) = toElem x

       ----

Name

       MkOneOf - a helper program to use with DtdToHaskell

See Also

DtdToHaskell(1)

Synopsis

MkOneOf n [m]

See Also