[Haskell-cafe] Layout to non-layout code

Maurí­cio briqueabraque at yahoo.com
Fri Nov 2 19:46:10 EDT 2007


I understand that many people like using
layout in their code, and 99% of all
Haskell examples use some kind of layout
rule. However, sometimes, I would like
not to use layout, so I can find errors
easier (and maybe convert it to layout for
presentation after all problems are solved).

So, I wonder: would it be possible to
implement a feature in, say, ghc, that would
take code from input and output the same
code with layout replaced by delimiting
characters? For instance, it could take
(untested code warning here):

main = do
   s <- readLn
   putStrLn s

and convert it to:

main = do {s<-readLn; putStrLn s};

I imagine that would be easy, since the
compiler has to do that as a first step

If it's possible, how can I sugest that


More information about the Haskell-Cafe mailing list