MkOneOf(1)
π MkOneOf π
okay bestie, this is the manual page for MkOneOf, filed under User Commands π it's a tiny helper tool that works alongside DtdToHaskell and it's honestly so iconic πβ¨
β¨ NAME β¨
MkOneOf is a helper program to use with DtdToHaskell π«Ά
π« SYNOPSIS π«
MkOneOf n [m]
πΈ DESCRIPTION πΈ
okay so DtdToHaskell turns XML DTDs into Haskell types π§ and whenever there's a choice between different tags, it reaches for types like OneOf2, OneOf3, OneOf4, and so on π the module Text.XML.HaXml.OneOfN already defines these types, but only up to OneOf20 π₯Ί so if your DTD needs bigger choices, MkOneOf is the one that saves the day π
MkOneOf takes either a single integer N, or an integer range N M, and prints a Haskell module to the standard output π¦ with either the datatype OneOfN, or the datatypes OneOfN up to and including OneOfM β¨
π¦ EXAMPLES π¦
literally the best part π if we run MkOneOf 1 2, the program will print this:
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
----
π COPYRIGHT π
the HaXml library and tools were written by and are copyright to:
Copyright Β© 1998 β 2006 Malcolm Wallace and Colin Runciman
the library incorporates the module Text.ParserCombinators.HuttonMeijerWallace, which is:
Copyright Β© 1996 Graham Hutton and Erik Meijer
with modifications:
Copyright Β© 1998 β 2000 Malcolm Wallace
and it may also use or incorporate the module Text.PrettyPrint.HughesPJ:
Copyright Β© 1996 β 1997 John Hughes and Simon Peyton Jones
the HaXml library is licensed under the terms of the GNU Lesser General Public Licence (LGPL), with the following special exception π
As a relaxation of clause 6 of the LGPL, the copyright holders of this library give permission to use, copy, link, modify, and distribute, binary-only object-code versions of an executable linked with the Library, without requiring the supply of any mechanism to modify or replace the Library and relink (clauses 6a, 6b, 6c, 6d, 6e), provided that all the other terms of clause 6 are complied with.
the HaXml tools Xtract, Validate, DtdToHaskell, and MkOneOf are licensed under the terms of the GNU General Public Licence (GPL) π
this library and toolset is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE π see the GNU Licences for more details.
π§ SEE ALSO π§
π 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) π«Ά
that's the whole tea, bestie! π¦ MkOneOf version 1.17, October 2007 π stay iconic, and go make your DTDs slay πβ¨
π¦ where this page comes from
- debian bookworm: haxml 1:1.25.11-1 Β· LGPL-2.1-only
- debian trixie: haxml 1:1.25.13-2+b1 Β· LGPL-2.1-only
- ubuntu jammy: haxml 1:1.25.5-2build3.1 Β· LGPL-2.1-only
- ubuntu noble: haxml 1:1.25.13-1build1 Β· LGPL-2.1-only
- ubuntu questing: haxml 1:1.25.13-2
- ubuntu resolute: haxml 1:1.25.14-1 Β· LGPL-2.1-only
- ubuntu stonking: haxml 1:1.25.14-1 Β· LGPL-2.1-only
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms