Scripting XML with Generic Haskell

Abstract

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

Similar works

Full text

thumbnail-image

Utrecht University Repository

redirect
Last time updated on 14/06/2016

This paper was published in Utrecht University Repository.

Having an issue?

Is data on this page outdated, violates copyrights or anything else? Report the problem now and we will take corresponding actions after reviewing your request.