Make DeriveFunctor work with unboxed tuples
authorRyan Scott <ryan.gl.scott@gmail.com>
Mon, 18 Jul 2016 13:28:42 +0000 (09:28 -0400)
committerBen Gamari <ben@smart-cactus.org>
Thu, 25 Aug 2016 14:12:46 +0000 (10:12 -0400)
commit1f862acbd7d38b28a205002cded4f7b8824262e5
tree3cc1dfa3a02bda836690be7000c8c88bcb05e898
parent2756af87aebee769ffca959adc4b9dc607a49fdb
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

(cherry picked from commit 3fa3fe8a9a8afa67829e12efa5d25b76e58a185a)
compiler/typecheck/TcGenDeriv.hs
testsuite/tests/deriving/should_compile/T12399.hs [new file with mode: 0644]
testsuite/tests/deriving/should_compile/all.T