Haskell-src-ext

Niklas Broberg niklas.broberg at gmail.com
Mon Apr 14 12:02:36 EDT 2008


>  Hi Niklas,
>  nice to meet you.

Likewise. :-)

>  I'm planning to extend shim to get a more featured ide (vim / emacs..
>  Maybe the Eclipse supporters do join as well?)
>
>  One thing I'd like to add is adding modules/ import statements to a
>  module.
>  Do you think your' parsers / resulting abstract syntax tree is suited
>  to add some import statements? Or do you suggest hacking my own fuzzy
>  approach?

I'd say that's definitely a good use of  haskell-src-exts, and very
easy to accomplish. A fuzzy approach sounds scary to me. ;-)

>  Is it easy to explain the main difference between your output and the
>  output produced by the GHC parser?

I'd say the most striking difference is that the AST used by
haskell-src-exts is much much simpler than the GHC one. It's only an
AST, it doesn't try to cater to the different passes of a compiler to
do renaming or any such nonsense. It is also contained in a single
module so it is easy to reference (try digging up where some specific
constructor in the GHC AST is defined and you'll appreciate the merit
of this).

For any project that just needs to parse/fiddle with/print haskell
source code, I see very little reason to choose GHC API instead of
haskell-src-exts. The only reason is of course that GHC API is
guaranteed to be up to date with the latest GHC, and will be able to
parse exactly everything that GHC does. On the other hand,
haskell-src-exts allows you to handle regular patterns and literal XML
syntax a la HSP, which GHC doesn't. :-)

Cheers,

/Niklas


More information about the Glasgow-haskell-users mailing list