GHC API (parsing)

Niklas Broberg niklas.broberg at
Mon Apr 14 07:57:40 EDT 2008

>  * it's not exactly a drop-in replacement for Language.Haskell.* ?
>   (HsNewTypeDecl is different?)
>  *  for the others, number of constructor arguments does not match, e.g.
>    `HsConDecl' should have 2 arguments, but has been given 3

Indeed it is like you say, these are pragmatic choices. The extensions
introduce new requirements, and the choice was between modelling only
the general case, or separating the H98 case and the extension as two
different constructors. I chose the former, since I believe anyone
using this library would want to use the extensions anyway, and
choosing the latter would have meant a lot of extra boilerplate code
(for the user, not me).

>  * how is your parser tied to ghc?
>   I.e. what happens if the next ghc release introduces new syntax?

It is not at all tied to ghc, other than that I try to keep up with
the major extensions that ghc provides. There are some things in ghc
that my library does not model, e.g. arrows syntax (patches welcome!).
But if there's anything specific that you need that isn't already in
there, drop me a feature request and I'll try to fix it for you.



More information about the Glasgow-haskell-users mailing list