showsPrec: cui bono?

Jerzy Karczmarczuk karczma@info.unicaen.fr
Tue, 12 Nov 2002 15:06:11 +0100


A simple, primitive question:

has anybody here used in a non-trivial way the showsPrec anti-parser?
My students asked me what is it for, it is never used in the Hugs
Prelude, OK, once: possible parentheses around fractions n%d.

I explained that it is a good contraption to make one own pretty-
printers, like readsPrec can be useful for simple, precedence-based
parsers.

But I am still unhappy. The associativity is not taken into account,
and for non-trivial purposes both ...Prec functions seem not as useful
as I would like.

Any comments?  Thanks.

Jerzy Karczmarczuk