Large tuple strategy

Ben Gamari ben at smart-cactus.org
Thu Jan 5 16:18:42 UTC 2017


Reid Barton <rwbarton at gmail.com> writes:

> Hi all,
>
> https://phabricator.haskell.org/D2899 proposes adding Generic
> instances for large tuples (up to size 62). Currently GHC only
> provides Generic instances for tuples of size up to 7. There's been
> some concern about the effect that all these instances will have on
> compilation time for anyone who uses Generics, even if they don't
> actually use the new instances.
>
> There was a suggestion to move these new instances to a separate
> module, but as these instances would then be orphans, I believe GHC
> would have to read the interface file for that module anyways once
> Generic comes into scope, which would defeat the purpose of the split.
>
> It occurred to me that rather than moving just these instances to a
> new module, we could move the large tuples themselves to a new module
> Data.LargeTuple and put the instances there. The Prelude would
> reexport the large tuples, so there would be no user-visible change.
> According to my experiments, GHC should never have to read the
> Data.LargeTuple interface file unless a program actually mentions a
> large tuple type, which is presumably rare. We could then also extend
> the existing instances for Eq, Show, etc., which are currently only
> provided through 15-tuples.
>
Good catch Reid!

Cheers,

- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170105/a6950dd3/attachment.sig>


More information about the ghc-devs mailing list