Discussion: adding displayException to Exception class

Herbert Valerio Riedel hvr at gnu.org
Wed Oct 29 08:39:07 UTC 2014


Hi Michael,

On 2014-10-29 at 00:43:55 +0100, Michael Snoyman wrote:
> I don't want to make a format proposal yet, just open up discussion on an
> issue, and see how others feel about it.
>
> As I recently commented on this list[1], the Show typeclass is overloaded
> with multiple meanings (serialization, debug info, and user-friendly data
> display). The general consensus seems to be that the official semantics for
> Show should be for serialization (as paired up with Read).

[...]

> I have a possible solution that I'd like to propose as a strawman: add a
> new method to the Exception typeclass:
>
>     displayException :: e -> String
>     displayException = show

As we're having the general problem of 'Show' being abused for
pretty-printing, why not rather standardise on a pretty-show/printing
typeclass that would not be limited to Exceptions? What am I missing?

Cheers,
  hvr


More information about the Libraries mailing list