[Haskell-cafe] haskell-src-exts Question
Niklas Broberg
niklas.broberg at gmail.com
Fri Nov 13 07:51:05 EST 2009
Hi Dominic,
On Fri, Nov 13, 2009 at 9:49 AM, Dominic Steinitz <dominic at steinitz.org> wrote:
> I would have expected the prettyprinter to produce this:
>
> pay tPD (a (length tOD + -1))
>
> Do I have to write my own prettyprinter? Do I have to put in explicit
> parentheses? The latter seems unsatisfactory as my generated AST is unambiguous
> and bracketing ought to be part of the prettyprinter. The former would be quite
> a lot of code as there are many cases to consider.
I will start by admitting that the prettyprinter is something of the
black sheep of HSE, simply because it's been completely inherited from
haskell-src and I've hardly messed with at all (except for adding new
cases of course). I'm not surprised that it doesn't (yet) work
satisfactorily in all cases.
Looking at your example, what you want is brackets to be inserted
whenever the right subexpression in an application is non-atomic. That
certainly seems reasonable to me. Would you file a ticket for it
please? http://trac.haskell.org/haskell-src-exts :-)
Cheers,
/Niklas
More information about the Haskell-Cafe
mailing list