Discussion: adding displayException to Exception class

Dominique Devriese dominique.devriese at cs.kuleuven.be
Wed Oct 29 11:43:13 UTC 2014


2014-10-29 12:25 GMT+01:00 Michael Snoyman <michael at snoyman.com>:
> [possible use cases for Show]
> 1. Express a valid Haskell expression for copy/paste reasons.
> 2. Express a valid Haskell expression to make it easy to determine the type
> of the exception thrown (even though that's not always enough information).
> 3. Express something that can be consumed by Read for easy serialization.
> 4. Print something which is meaningful to a Haskell developer.
> 5. Print something which would be meaningful to an end user.

If we enter this discussion, I think we should keep in mind how some
of these uses are encouraged by the infrastructure.  Specifically:
* the fact that GHCi uses Show for printing result values, counts (at
least for me) as an implicit vote for use case (4)
* the fact that deriving Show is directly supported by the compiler
(contrary to Binary, for example) making it easier to use Show than
more appropriate alternatives.  If we think Show is the wrong solution
for serialisation, then maybe the compiler should provide equivalent
support for a more adequate solution, for example?

Regards,
Dominique


More information about the Libraries mailing list