Niklas Broberg niklas.broberg at gmail.com
Mon Apr 14 17:58:18 EDT 2008

> > Except for line numbering (it inserts but doesn't read line pragmas),
> > the AST should be preserved under f = parse . pretty.
>  and what about (pretty . parse) = id :: String -> String ?-)

Most certainly not I'm afraid. It doesn't handle pragmas at all
(treats them as comments), and by default it inserts line pragmas in
the output (though that can be turned off). Comments are simply
discarded, and to be honest I really don't see how they could be kept
in general, except in specific pre-defined places (like for Haddock).
I'm sure you have ideas on that though. Layout is also not preserved
exactly, and do { ... ; ... } results in the same AST as if done with
layout instead of { ; }.

>  preserving everything that isn't transformed at the AST level
>  would be a necessary starting point for refactoring larger
>  code bases. having easy access to comments and layout
>  information is where most frontends tend to let us down.

Indeed, and I'm afraid haskell-src-exts will join the crowd in that
regard. But to be honest I'm not sure haskell-src-exts *should* do
those things you ask for, since the added machinery would be rather
heavy-weight for applications that just want the basic stuff, which I
guess is the vast majority of applications.

>  ps it is good to hear that src-ext is supported, follows language
> developments, and is separated from the other parts of your
> projects!-)

Thanks, and yes I try to keep them as separate as possible, knowing
their usefulness to others.



More information about the Glasgow-haskell-users mailing list