Skip to main content
Article thumbnail
Location of Repository

Scripting XML with Generic Haskell

By F. Atanassow, D. Clarke and J.T. Jeuring


A generic program is written once and works on values of many data\ud types. Generic Haskell is a recent extension of the functional programming\ud language Haskell that supports generic programming. This paper discusses how\ud Generic Haskell can be used to implement XML tools whose behaviour depends\ud on the DTD or Schema of the input XML document. Example tools include\ud XML editors, databases, and compressors. Generic Haskell is ideally suited for\ud implementing XML tools:\ud • Knowledge of the DTD can be used to provide more precise functionality,\ud such as manipulations of an XML document that preserve validity in an\ud XML editor, or better compression in an XML compressor.\ud • Generic Haskell programs are typed. Consequently, valid documents\ud are transformed to valid documents, possibly structured according to\ud another DTD. Thus Generic Haskell supports the construction of type\ud correct XML tools.\ud • The generic features of Generic Haskell make XML tools easier to implement\ud in a surprisingly small amount of code.\ud • The Generic Haskell compiler may perform all kinds of advanced optimisations\ud on the code, such as partial evaluation or deforestation, which\ud are difficult to conceive or implement by an XML tool developer.\ud By embedding Schema and XML data into Haskell data types, we show how\ud Generic Haskell can be used as a generic XML processing language. We will\ud demonstrate the approach by implementing an XML compressor in Generic\ud Haskell

Topics: Wiskunde en Informatica
Publisher: Proceedings of the 7th Brazilian Symposium on Programming Languages
Year: 2003
OAI identifier:
Download PDF:
Sorry, we are unable to provide the full text but you may find it at the following location(s):
  • (external link)
  • Suggested articles

    To submit an update or takedown request for this paper, please submit an Update/Correction/Removal Request.