Discussion: adding displayException to Exception class

Andreas Abel abela at chalmers.se
Thu Oct 30 16:24:58 UTC 2014


On 29.10.2014 12:18, Simon Peyton Jones wrote:
> 1.Serialisation (use Binary)
>
> 2.Copy-pasteable into Haskell source file, but not necessarily
> human-readable (Show)
>
> 3.Human readable (Display)

+1.

These should all be separate, and we want a standard class for 3. 
"Display" seems to be a good name.

> It’s clearly a library-design issue whether (2) and (3) are worth
> separating.   More classes, more code, but perhaps more expressiveness.
> What does the core libraries committee think?  Personally I don’t see
> (2) as particularly important, but my opinion counts for little since
> I’m not a library author.
>
> Simon
>
> *From:*Libraries [mailto:libraries-bounces at haskell.org] *On Behalf Of
> *Michael Snoyman
> *Sent:* 29 October 2014 11:02
> *To:* Simon Peyton Jones
> *Cc:* libraries
> *Subject:* Re: Discussion: adding displayException to Exception class
>
> On Wed, Oct 29, 2014 at 10:45 AM, Simon Peyton Jones
> <simonpj at microsoft.com <mailto:simonpj at microsoft.com>> wrote:
>
>     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).
>
>     Really?  My instinct is otherwise: *to use Show for human-readable
>     display, and Binary for serialisation*.  Show/Read is a terribly
>     inefficient serialisation format; as soon as you want to do it for
>     real you end up with Binary anyway.  And Show is already well
>     established for human-readable purposes – that was one of its
>     primary original purposes.
>
>     Simon
>
> My weak vote in that thread went towards Show for human-readable
> display, but there was some quite harsh objection to that position. In
> this thread too you can see people wanting a direct encoding of types
> which can be copy-pasted into a Haskell source file. Personally, I don't
> see much need for that, and especially given the new ability to
> essentially auto-derive Binary instances (via Generic), Show/Read
> serialization seems fairly pointless.
>
> Nonetheless, making a proposal that doesn't enforce a changed semantics
> on the Show typeclass seems like the path of least resistance. If others
> want to jump back into the previous topic and try to hammer down the
> ideal usage of the Show typeclass, I'm happy to participate in that
> discussion too.
>
> Michael
>
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>


-- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Department of Computer Science and Engineering
Chalmers and Gothenburg University, Sweden

andreas.abel at gu.se
http://www2.tcs.ifi.lmu.de/~abel/


More information about the Libraries mailing list