As an exercise to learn Haskell (and torture myself), I am considering writing a configurable Haskell code beautifier.
It will support a configuration file written in JSON or YAML (or something better?) that specifies choices like sorting imports, sorting/grouping data
and class
statements, number of lines between sections, etc.
I am looking for a parser for Haskell 98 that generates an abstract syntax tree (AST) and retains comments. Parsing GHC, with its language extensions, will be a bonus.
In the absence of such a thing, I guess I can write a recursive-descent parser or one using Parsec or a parser generator. Maybe rolling my own will increase the learning (and torture :-)).
Is there a complete Haskell->AST parser available under one of the open source licenses? If I make any progress on this project, I'll put it up on github.