Allow GeneralizedNewtypeDeriving for classes with associated type families
authorRyan Scott <ryan.gl.scott@gmail.com>
Sun, 6 Nov 2016 14:09:36 +0000 (09:09 -0500)
committerRyan Scott <ryan.gl.scott@gmail.com>
Sun, 6 Nov 2016 14:09:36 +0000 (09:09 -0500)
commit630d88176e8dd3ccc269451bca8f55398ef5265c
tree71660e73c5e770ee83a1bbad4452a0d23e20f42a
parent25c8e80eccc512d05c0ca8df401271db65b5987b
Allow GeneralizedNewtypeDeriving for classes with associated type families

Summary:
This implements the ability to derive associated type family instances
for newtypes automatically using `GeneralizedNewtypeDeriving`. Refer to the
users' guide additions for how this works; I essentially follow the pattern
laid out in https://ghc.haskell.org/trac/ghc/ticket/8165#comment:18.

Fixes #2721 and #8165.

Test Plan: ./validate

Reviewers: simonpj, goldfire, austin, bgamari

Reviewed By: simonpj

Subscribers: mpickering, thomie

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

GHC Trac Issues: #2721, #8165
20 files changed:
compiler/typecheck/TcDeriv.hs
compiler/typecheck/TcGenDeriv.hs
compiler/utils/Util.hs
docs/users_guide/8.2.1-notes.rst
docs/users_guide/glasgow_exts.rst
testsuite/tests/deriving/should_compile/T2721.hs [moved from testsuite/tests/deriving/should_fail/T2721.hs with 85% similarity]
testsuite/tests/deriving/should_compile/T8165.hs [new file with mode: 0644]
testsuite/tests/deriving/should_compile/all.T
testsuite/tests/deriving/should_fail/T2721.stderr [deleted file]
testsuite/tests/deriving/should_fail/T4083.hs [new file with mode: 0644]
testsuite/tests/deriving/should_fail/T4083.stderr [new file with mode: 0644]
testsuite/tests/deriving/should_fail/T8165_fail1.hs [new file with mode: 0644]
testsuite/tests/deriving/should_fail/T8165_fail1.stderr [new file with mode: 0644]
testsuite/tests/deriving/should_fail/T8165_fail2.hs [new file with mode: 0644]
testsuite/tests/deriving/should_fail/T8165_fail2.stderr [new file with mode: 0644]
testsuite/tests/deriving/should_fail/all.T
testsuite/tests/generics/GenDerivOutput.stderr
testsuite/tests/generics/GenDerivOutput1_0.stderr
testsuite/tests/generics/GenDerivOutput1_1.stderr
testsuite/tests/generics/T10604/T10604_deriving.stderr