[Haskell-cafe] Haskell source transformer?
lemmih at gmail.com
Sat Dec 2 02:37:36 EST 2006
On 11/30/06, Dimitry Golubovsky <golubovsky at gmail.com> wrote:
> In order to automatize the creation of W3C DOM typesafe wrapper (this
> IDL files that contain interface definitions for DOM methods and
> attributes with HDirect.
> It works in general (for some reason it didn't like "boolean" type, so
> I used a preprocessor to redefine it as "Boolean"), and outputs some
> Haskell code full of foreign calls, yet it contains what I need: type
> For example, for the method "appendChild" it outputs:
> appendChild :: Node a1
> -> Node a0
> -> Prelude.IO (Node ())
> appendChild newChild iptr =
> o_appendChild <- Com.invokeIt (\ methPtr iptr ->
> Foreign.ForeignPtr.withForeignPtr newChild (\ new
> unmarshallNode o_appendChild
> (above lines of code may be truncated, they are just for illustration)
> This is almost it, but I need to replace the return type (using the JS
> monad instead of IO), and replace the method implementation with
> something else, based on unsafeJS.
> In some other cases I may need to modify type declarations, etc.
> I know there is a Haskell syntax parser around (maybe, more than one).
> Does anybody know of any utility based on such parser that does things
> I need, or rather a library on top of the parser? I just would like to
> avoid reinventing the wheel.
> Last thing I want to do is to change sources of HDirect.
There's haskell-src and haskell-src-exts (
More information about the Haskell-Cafe