showing Ratios

Jon Fairbairn jon.fairbairn at
Tue Mar 2 04:41:19 EST 2010

Evan Laforge <qdunkan at>

> 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.

Probably because that's not what it was originally intended for.

> I actually have a separate Pretty class

So do quite a few people!

> 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.

It makes little difference to me whether we have different
classes for Pretty and Show or just a pshow in Show

> 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.

I think my argument is that producing human-readable output is a
sufficiently common requirement that it should be fairly
available from somewhere everyone knows to look. Personally, I'd
remove most of the prelude and put more of it in standard
libraries that everyone is expected to know about early on in
learning the language.

Jón Fairbairn                                 Jon.Fairbairn at

More information about the Haskell-prime mailing list