Datatypes which differ inessentially in their names and structure are said to be isomorphic; for example, a ternary product is isomorphic to a nested pair of binary products. In some canonical cases, the conversion function is uniquely determined solely by the two types involved. In this article we describe and implement a program in Generic Haskell which automatically infers this function by normalizing types w.r.t. an algebraic theory of canonical isomorphisms. A simple generalization of this technique also allows to infer some non-invertible coercions such as projections, injections and ad hoc coercions between base types. We explain how this technique has been used to drastically improve the usability of a Haskell-XML Schema data binding, and suggest how it might be applied to improve other type-safe language embeddings.
This paper introduces a type-preserving XML Schema-Haskell data binding (or, translation) UUXML, and shows how to customize it by exploiting the theory of canonical isomorphisms to automatically infer coercions between the machine-generated types and an equivalent, more natural, user-defined set of types. We show how to implement the inference mechanism in Generic Haskell.
An XML data binding is a translation of XML documents into values of some programming language. This paper discusses a typepreserving XML-Haskell data binding that handles documents typed by the W3C XML Schema standard. Our translation is based on a formal semantics of Schema, and has been proved sound with respect to the semantics. We also show a program in Generic Haskell that constructs parsers specialized to a particular Schema type.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.