[Haskell-cafe] Layout to non-layout code
Don Stewart
dons at galois.com
Fri Nov 2 19:59:17 EDT 2007
briqueabraque:
> Hi,
>
> 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
> anyway.
>
> If it's possible, how can I sugest that
> feature?
ghc -ddump-parsed does this, iirc.
So does the Language.Haskell library. See this wiki page on indenting
for more ideas,
http://haskell.org/haskellwiki/Indent
-- Don
More information about the Haskell-Cafe
mailing list