PROPOSAL: Add displayException to Exception typeclass

Michael Snoyman michael at snoyman.com
Fri Nov 21 10:32:36 UTC 2014


I realize it's a few days shy of the 2 week mark, but discussion has
stopped, and there seems to be no objection to the first half of this
proposal. Given that freeze is fast approaching for 7.10, I'd like to move
ahead with implementation of this (which is admittedly an incredibly
trivial patch).

I've created a Trac ticket for this:

https://ghc.haskell.org/trac/ghc/ticket/9822

Thanks all for the discussion.

On Mon Nov 10 2014 at 4:01:34 PM Michael Snoyman <michael at snoyman.com>
wrote:

> I started a discussion a few weeks back on some theoretical changes to how
> exceptions are displayed. That discussion covered a lot of different
> ground. I'd now like to formally propose the original change I mentioned in
> that thread:
>
> 1.  Add a new method to the Exception typeclass:
>
>     -- | Render this exception value in a human-friendly manner. Default
> implementation: @show at .
>     displayException :: e -> String
>     displayException = show
>
> 2. Modify GHC's default exception handler to use `displayException`
> instead of `show`.
>
> This change will, on its own, cause no breakage[1] and, without further
> action, will have no change in program behavior. It does, however, allow
> users to begin distinguishing between how their exceptions should be
> `show`n versus how they should be displayed to an end user.
>
> Note that I am *not* proposing at this time any other changes discussed in
> the previous thread. If someone wants to propose removing Show
> superclasses, adding a Read superclass, providing a typeRepStack method[2],
> or something else, please propose it separately.
>
> Discussion period: two weeks.
>
> Michael
>
> [1] Besides introducing a new, possibly clashing identifier name.
> [2] That one actually seems like a very good idea to me.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141121/cccbf4c3/attachment.html>


More information about the Libraries mailing list