Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement NFData for TypeRep in older GHC's #37

Closed
ndmitchell opened this issue Nov 16, 2017 · 3 comments
Closed

Implement NFData for TypeRep in older GHC's #37

ndmitchell opened this issue Nov 16, 2017 · 3 comments

Comments

@ndmitchell
Copy link

NFData for TypeRep is only implemented in newer GHC's. I suggest implementing it as rnf . show in those older GHCs so at least it is available, even if less efficient.

@RyanGlScott
Copy link
Member

I'm not sure if show would be sufficient to actually reduce these to normal form. As one example, on base-4.7, the Show instance for TyCon is simply:

instance Show TyCon where
  showsPrec _ t = showString (tyConName t)

So it will only force the tyConName, and not the tyConPackage or tyConModule.

@ndmitchell
Copy link
Author

ndmitchell commented Mar 19, 2018

Yep, show might not be the right way forward, but you can do it by poking inside TyCon, which is entirely exposed via the Internal module in base-4.7.0.2

@RyanGlScott
Copy link
Member

Ah! Good point. This is actually quite doable then.

#40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants