Why are there no Show instances for internal types

Tom Sydney Kerckhove syd.kerckhove at gmail.com
Sat Mar 18 22:55:24 UTC 2017


On 18-03-17 16:13:52, Ben Gamari wrote:
> 
> 
> On March 18, 2017 9:03:48 AM EDT, Tom Sydney Kerckhove <syd.kerckhove at gmail.com> wrote:
> 
> Snip.
> >
> >My questions for you:
> >
> >- Is there a reason that there are no derived 'Show' instances for most
> >  types?
> 
> As Richard mentioned, we don't derive Show due to code size and compilation time concerns.

Okay.

> Show in particular is rather expensive to derive and seeing as we already have Outputable I don't it would make sense to derive it by default.

Show and Outputable have very different goals though.

> I would really like to avoid introducing more CPP into the code base for this particular problem.

Fair enough.

> One alternative which will work in many cases is to simply derive Show yourself using StandaloneDeriving. Does this help?

That doesn't work if some type doesn't have the constructors exposed.
I tried this already, and it would be a good solution if all
constructors were exposed, ...

> Cheers,
> 
> - Ben 
> 
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
Tom Sydney Kerckhove
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170318/5bfd88b6/attachment.sig>


More information about the ghc-devs mailing list