Fix #14729 by making the normaliser homogeneous
authorRichard Eisenberg <rae@cs.brynmawr.edu>
Thu, 24 Jan 2019 15:22:58 +0000 (10:22 -0500)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Fri, 8 Feb 2019 15:59:28 +0000 (10:59 -0500)
commit2b90356d26b4699227816ad9424e766eccdb6c36
tree8b0faf0e858edd1ec80777424e609c35cd5babb6
parentaad05fb3b36b93b919622f8a6dc032109d040d16
Fix #14729 by making the normaliser homogeneous

This ports the fix to #12919 to the normaliser. (#12919 was about
the flattener.) Because the fix is involved, this is done by
moving the critical piece of code to Coercion, and then calling
this from both the flattener and the normaliser.

The key bit is: simplifying type families in a type is always
a *homogeneous* operation. See #12919 for a discussion of why
this is the Right Way to simplify type families.

Also fixes #15549.

test case: dependent/should_compile/T14729{,kind}
           typecheck/should_compile/T15549[ab]
13 files changed:
compiler/deSugar/Check.hs
compiler/typecheck/TcFlatten.hs
compiler/types/Coercion.hs
compiler/types/FamInstEnv.hs
compiler/types/Type.hs
testsuite/tests/dependent/should_compile/T14729.hs [new file with mode: 0644]
testsuite/tests/dependent/should_compile/T14729.stderr [new file with mode: 0644]
testsuite/tests/dependent/should_compile/T14729kind.script [new file with mode: 0644]
testsuite/tests/dependent/should_compile/T14729kind.stdout [new file with mode: 0644]
testsuite/tests/dependent/should_compile/all.T
testsuite/tests/typecheck/should_compile/T15549a.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T15549b.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/all.T