[Haskell-beginners] Generate API implementations from XML

Thomas Koch thomas at koch.ro
Sun Jan 4 11:26:54 UTC 2015


Hi,

as written in my previous mail, I'm implementing a dbus interface in Haskell. 
The interface definition is given in XML[1] according to a given dtd[2].

For every dbus method one need to invoke[3]
export :: Client -> ObjectPath -> [Method] -> IO ()

What would be a good way to autogenerate all this export calls and Method 
instances? All necessary informations are given in the dbus spec xml.

One could write a script that writes Haskell code.
Or one could use template haskell that reads the xml file at compile time?
Or?

Do you know other examples to learn from that autogenerate Haskell code from 
interface definitions?

Thank you, Thomas Koch

[1] http://code.metager.de/source/xref/freedesktop/xdg/specs/secret-service/org.freedesktop.Secrets.xml
[2] http://standards.freedesktop.org/dbus/1.0/introspect.dtd
[3] http://hackage.haskell.org/package/dbus-0.10.9/docs/DBus-Client.html#v:export


More information about the Beginners mailing list