[Haskell-cafe] Haskell2Xml

Sean Leather leather at cs.uu.nl
Fri Aug 7 07:37:06 EDT 2009


Hi Dmitry,

Well, great thanks for interesting links.
>
> But definitely at first I need a time to try to understand what Generic
> Haskell and EMGM are.
>

Generic Haskell (GH) is a language extension implementing datatype-generic
programming features on top of Haskell. It is implemented using a
preprocessor that compiles source to Haskell.

EMGM ("Extensible and Modular Generics for the Masses") is an example of a
Haskell library that allows you to implement many of the GH functions
directly in Haskell without a preprocessor.


> Does it stronger than Template Haskell? Could it be explained briefly and
> simplistic for first impression? Could it be compared with SYB or TH?
>

Template Haskell is a syntax-based metaprogramming extension to Haskell.
Many datatype-generic things can be done in TH, but it often takes a lot of
work because you're generating syntax. EMGM actually uses TH to generate
representation values of datatypes.

SYB is another example of a datatype-generic library. It uses a different
representation of datatypes than EMGM and GH. As a result, the libraries
support different kinds of functions (sometimes completely different, but
sometimes the same and implemented differently).


> Would it be applied to realisation of translation or to target Haskell
> code?
>

To use something like EMGM or SYB, one uses or develops functions for
manipulating values of arbitrary datatypes. Think of what happens when you
"derive (Eq, Read, Show)" for example. You are getting functions (==), read,
and show that work for your datatype. You can do this same sort of thing
with other functions in SYB and EMGM.

As for your use case, I don't know if one of the libraries can help you
directly. You wanted to first get the datatypes from XML Schemas, and that's
going to require something like HaXml. But once you do get those datatypes,
you can use one of the many generic programming libraries to manipulate
values without having to write your own functions.

For a tutorial on using EMGM and SYB, see our recently published tech.
report:

Libraries for Generic Programming in Haskell
Johan Jeuring, Sean Leather, José Pedro Magalhães, and Alexey Rodriguez
Yakushev
http://www.cs.uu.nl/research/techreps/UU-CS-2008-025.html

Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090807/99349cd1/attachment.html


More information about the Haskell-Cafe mailing list