Why are there no Show instances for internal types

Richard Eisenberg rae at cs.brynmawr.edu
Sat Mar 18 13:11:17 UTC 2017


My take is that we don't have these because they would slow down compilation times and add bloat. But enough people have asked for them (and, I can think of a few times when I would use them myself) that I think they should be added.

It is conceivable that we could make the instances only when DEBUG is on. That would, I believe, involve some unsavory CPP, and may not be worth it. What do others think?

Richard

> On Mar 18, 2017, at 9:03 AM, Tom Sydney Kerckhove <syd.kerckhove at gmail.com> wrote:
> 
> Dear GHC Devs,
> 
> I am trying to use GHC as a library but I'm having a lot of trouble with
> understanding what everything means.
> Up to now, I have been able to figure out what to do by reading the
> sources, but it ocured to me that much of my struggles could have been
> mitigated if the relevant types had Show instances.
> 
> I am specifically talking about the types concerning type checking.
> TypecheckedModule and everything below that.
> I am aware that most of the types have an Outputable instance, but
> there are two problems with that:
> 
> - 'Outputting' a value requires DynFlags. (yes, I know about pprTrace)
> - These instances are not intended to show the internal structure of a
>  value, but rather a 'human readable' representation of a value.
> 
> My questions for you:
> 
> - Is there a reason that there are no derived 'Show' instances for most
>  types?
> - Would you accept a diff that adds these?
> 
> Thank you for your time.
> 
> -- 
> Tom Sydney Kerckhove
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs



More information about the ghc-devs mailing list