Data.Display - Textual representation of Haskell values (was Re: PROPOSAL: Add displayException to Exception typeclass)

Evan Laforge qdunkan at gmail.com
Mon Nov 10 20:34:01 UTC 2014


On Mon, Nov 10, 2014 at 12:13 PM, Greg Weber <greg at gregweber.info> wrote:
> Still, as it stands, I don't think that will work. A display type for a Map
> really needs to specify how a key/value pairing is displayed, and how the
> Map container is displayed, and needs to hand off those instructions to a
> layout engine.

Relatedly, I think what "pretty" means is project specific.  For
example, my pretty floats print like "%.2f", because I usually don't
need to see anything past the 3rd decimal point.   When you're
scanning a list of numbers looking for oddities, having everything
formatted this way makes a huge difference for readability.  But
someone else will complain that everything is .99, and will find
scientific notation more useful.

But a library of utilities designed to construct your own Pretty /
Display class would be fine.  Of course that's basically what the
various pretty-print libraries already are.

Mostly I just ask that library authors provide the functions to take
apart error types so I can write my own Pretty instances.


Of course python's str() / repr() doesn't worry about formatting
either.  Maybe it's useful to have a Show-alike somewhere in between
Show and Pretty.


More information about the Libraries mailing list