Discussion: adding displayException to Exception class

Simon Hengel sol at typeful.net
Wed Oct 29 03:55:39 UTC 2014


> +1 to having separate methods for Show-like and human-friendly
> displaying of exceptions.

Yes, I agree.

I've done a quick comparison on how Ruby/Python/Java convert exceptions
to strings:

    https://github.com/sol/exceptions-by-language

Note that in Ruby/Python there is a distinction between "getting a
representation of a value" (inspect/repr) and "converting a value into a
string" (to_s/str).  In Haskell we only have show, which is akin to
inspect/repr.

All of them still use a different formatting in the default handler, so
it may make still sense to make the full exception type accessible.  But
that could be a different discussion.

Cheers,
Simon


More information about the Libraries mailing list