[Haskell-cafe] Re: Editors for Haskell

Pete Kazmier pete-expires-20060806 at kazmier.com
Wed Jun 7 08:12:25 EDT 2006

"Simon Peyton-Jones" <simonpj at microsoft.com> writes:

> You probably know this, but your kind of application is a big reason
> that we now make GHC available as a library.  (Just say 'import GHC'.)  
> You shouldn't need to parse Haskell yourself: just call GHC's parser.
> You get back a syntax tree with very precise location information that
> can guide your editor (e.g. if you want to select a sub-exprssion).
> Similarly, you can call the type checker.

Are there any small examples of using GHC's parser?  I'm a complete
newbie so perhaps I'm not checking all of the relevant locations for
docs, but I can't seem to find this parser that is being referred to.
I checked out the source tree to GHC as well, but I have no idea where
to look in there (not to mention it's a bit intimidating).  Pointers
would be appreciated!

As part of my learning experience, I think I want to see if I can
write a haskell pastebin that does proper syntax highlighting.
Someone in #haskell suggested that I use just a lexer because using a
parser is overkill.  However, I can't make this assessment until I see
how to use the parser and the information it can supply.


More information about the Haskell-Cafe mailing list