[Haskell-cafe] New Layout Rule take 2

John Meacham john at repetae.net
Sat Dec 9 23:52:09 EST 2006

I have made some improvements to the algorithm, and I am happy to say
that with some minor tweaks, it correctly lays out the programs in the
nofib suite.

the algorithm is not much more complicated than the current one in the
report, but doesn't have the parse-error rule. it does require a single
token of lookahead to look for an "in".

darcs get http://repetae.net/repos/getlaid/

I have also added a mode so it can work as a ghc preprocesor, allowing
very easy testing. just compile with.

ghc -pgmF /path/to/getlaid -F --make Main.hs

and it will automatically process all your files.

Now, it isn't perfect. I can construct pathological examples that the
old rule would parse, but this one won't. however, if those examples
don't actually occur in practice, then that is not so much an issue.

my program doesn't handle many non-haskell 98 extensions, but can
probably be easily modified to do so.

John Meacham - ⑆repetae.net⑆john⑈

More information about the Haskell-Cafe mailing list