Remove the instantiation check when deriving Generic(1)
authorRyanGlScott <ryan.gl.scott@gmail.com>
Sun, 10 Apr 2016 20:59:37 +0000 (22:59 +0200)
committerBen Gamari <ben@smart-cactus.org>
Sun, 10 Apr 2016 21:41:16 +0000 (23:41 +0200)
commit7443e5c8dae24b83f5f4975c7accce02b819029c
tree80d9030b79ca386636916fc9f7a2cdd629d437d0
parentad532ded871a9a5180388a2b7cdbdc26e053284c
Remove the instantiation check when deriving Generic(1)

Previously, deriving `Generic(1)` bailed out when attempting to
instantiate visible type parameters (#5939), but this instantiation
check was quite fragile and doesn't interact well with `-XTypeInType`.
It has been decided that `Generic(1)` shouldn't be subjected to this
check anyway, so it has been removed, and `gen_Generic_binds`'s
machinery has been updated to substitute the type variables in a
generated `Rep`/`Rep1` instance with the user-supplied type arguments.

In addition, this also refactors `Condition` in `TcDeriv` a bit. Namely,
since we no longer need `tc_args` to check any conditions, the `[Type]`
component of `Condition` has been removed.

Fixes #11732.

Test Plan: ./validate

Reviewers: goldfire, kosmikus, simonpj, bgamari, austin

Reviewed By: simonpj, bgamari

Subscribers: thomie

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

GHC Trac Issues: #5939, #11732
compiler/typecheck/TcDeriv.hs
compiler/typecheck/TcGenGenerics.hs
docs/users_guide/8.0.1-notes.rst
testsuite/tests/deriving/should_compile/T11732a.hs [new file with mode: 0644]
testsuite/tests/deriving/should_compile/T11732b.hs [new file with mode: 0644]
testsuite/tests/deriving/should_compile/T11732c.hs [new file with mode: 0644]
testsuite/tests/deriving/should_compile/T5939.hs [new file with mode: 0644]
testsuite/tests/deriving/should_compile/all.T
testsuite/tests/generics/GenCannotDoRep0_0.stderr