<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 29, 2014 at 1:43 PM, Dominique Devriese <span dir="ltr"><<a href="mailto:dominique.devriese@cs.kuleuven.be" target="_blank">dominique.devriese@cs.kuleuven.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2014-10-29 12:25 GMT+01:00 Michael Snoyman <<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>>:<br>
> [possible use cases for Show]<br>
<span class="">> 1. Express a valid Haskell expression for copy/paste reasons.<br>
> 2. Express a valid Haskell expression to make it easy to determine the type<br>
> of the exception thrown (even though that's not always enough information).<br>
> 3. Express something that can be consumed by Read for easy serialization.<br>
> 4. Print something which is meaningful to a Haskell developer.<br>
> 5. Print something which would be meaningful to an end user.<br>
<br>
</span>If we enter this discussion, I think we should keep in mind how some<br>
of these uses are encouraged by the infrastructure.  Specifically:<br>
* the fact that GHCi uses Show for printing result values, counts (at<br>
least for me) as an implicit vote for use case (4)<br>
* the fact that deriving Show is directly supported by the compiler<br>
(contrary to Binary, for example) making it easier to use Show than<br>
more appropriate alternatives.  If we think Show is the wrong solution<br>
for serialisation, then maybe the compiler should provide equivalent<br>
support for a more adequate solution, for example?<br>
<br>
Regards,<br>
Dominique<br>
</blockquote></div><br></div><div class="gmail_extra">Those are good points. For your first one: that's why my quasi-proposal stated that GHC's default exception handler should switch over to using the new pretty-printed exception method (since I'd like (5) to be the target in that case). Regarding your second point: Generic-based instances go a long way towards solving that problem, and- unless I'm mistaken- starting with GHC 7.10 it will be possible to do something like:<br><br></div><div class="gmail_extra">data Foo = ...<br></div><div class="gmail_extra">    deriving (Generic, Binary, ToJSON, FromJSON)<br><br></div><div class="gmail_extra">Michael<br></div></div>