showing Ratios

Evan Laforge qdunkan at
Mon Mar 1 15:07:49 EST 2010

On Mon, Mar 1, 2010 at 1:29 AM, Jon Fairbairn
<jon.fairbairn at> wrote:
> Iavor Diatchki
> <iavor.diatchki at> writes:
>> Hi,
>> I am not sure about the rationale but if you need a program/library
>> which re-renders Show-able values with more spaces, so that they are
>> more human readable,  I wrote one
>> (  I find it very
>> useful for debugging.
> This comes up sufficiently often that perhaps the Show class
> should have readableShow that defaults to the same as show.

The thing I was curious about was why Show doesn't default to a more
pretty output in the first place.

I think it's appropriate that it doesn't insert extra newlines and
whatnot, we can already get that in an orthogonal way with Show and
reparsing with Language.Haskell.Syntax.

I actually have a separate Pretty class which, unlike Show, is under
no obligation to produce parseable or even unambiguous output.  This
is similar to Python's concept of separate str() and repr() functions.

And then a separate 'pshow :: Show a => a -> String' produces 'show'
output but with newlines and all lined up.  The missing bit is a
Pretty that produces a Text.PrettyPrint Doc, but this can all be done
without recourse to modifying the Prelude.

More information about the Haskell-prime mailing list