Make DeriveFunctor work with unboxed tuples
authorRyan Scott <ryan.gl.scott@gmail.com>
Mon, 18 Jul 2016 13:28:42 +0000 (09:28 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Mon, 18 Jul 2016 13:28:42 +0000 (09:28 -0400)
commit3fa3fe8a9a8afa67829e12efa5d25b76e58a185a
tree8dc8cc6190c6f8f0b1f05309f780a0e93160f65e
parentd213ab3fa0cc2a39d9f74df11c8a3451ac34411c
Make DeriveFunctor work with unboxed tuples

Summary:
Unboxed tuples have `RuntimeRep` arguments which `-XDeriveFunctor` was
mistaking for actual data constructor arguments. As a result, a derived
`Functor` instance for a datatype that contained an unboxed tuple would
generate twice as many arguments as it needed for an unboxed tuple pattern
match or expression. The solution is to simply put `dropRuntimeRepArgs` in the
right place.

Fixes #12399.

Test Plan: ./validate

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie, osa1

Differential Revision: https://phabricator.haskell.org/D2404

GHC Trac Issues: #12399
compiler/typecheck/TcGenDeriv.hs
testsuite/tests/deriving/should_compile/T12399.hs [new file with mode: 0644]
testsuite/tests/deriving/should_compile/all.T