[Haskell-cafe] generic preprocessor for haskell

Per Larsson per at L4i.se
Sat May 15 18:49:11 EDT 2004

I have recently made a small detour into ocaml programming and I'm rather 
impressed with the generic preprocessor 'camlp4' for ocaml. Camlp4 allows the 
programmer to (i) interact with the ocaml parser and lexer to extend the 
concrete grammar with new syntax and (ii) to directly define the translation 
of such new syntax forms in terms of ocaml abstract syntax. Haskell 
programmers (at least in GHC) can also manipulate abstract syntax with the 
Template Haskell extension and the Language.Haskell.THSyntax library, but to 
my knowing there is no haskell compiler which supports the inclusion of new 
syntax forms. Wouldn't such a tool be cool? In the haskell community there 
are a number of handmade preprocesserors (DrIFT, Generic Haskell, HaRP, ...) 
which  are both cumbersome to write, because the authors must write a 
(partial) haskell parser for every small extension, but also cumbersome to 
use because of increasing complexity to your makefiles and different 
standards for error reporting. Also, experimental extensions could quickly be 
written and evaluated by the haskell users, decreasing the dependency on the 
compiler maintainers.

Per Larsson

More information about the Haskell-Cafe mailing list