Clean up coreView/tcView.
authorBen Gamari <ben@smart-cactus.org>
Mon, 27 Mar 2017 17:17:00 +0000 (13:17 -0400)
committerBen Gamari <ben@smart-cactus.org>
Fri, 31 Mar 2017 21:37:04 +0000 (17:37 -0400)
commit6575f4b635a393775295798ca86c7c3ba00819be
tree6d974ae41d093ec43ac3c1d95c103a86830e6091
parent29645274a3c97a904759aa245dc8f8c03a58c601
Clean up coreView/tcView.

In Core, Constraint should be considered fully equal to
TYPE LiftedRep, in all ways. Accordingly, coreView should
unwrap Constraint to become TYPE LiftedRep. Of course, this
would be a disaster in the type checker.

So, where previously we used coreView in both the type checker
and in Core, we now have coreView and tcView, which differ only
in their treatment of Constraint.

Historical note: once upon a past, we had tcView distinct from
coreView. Back then, it was because newtypes were unwrapped in
Core but not in the type checker. The distinction is back, but
for a different reason than before.

This had a few knock-on effects:

 * The Typeable solver must explicitly handle Constraint to ensure
   that we produce the correct evidence.

 * TypeMap now respects the Constraint/Type distinction

Finished by: bgamari

Test Plan: ./validate

Reviewers: simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3316
25 files changed:
compiler/coreSyn/TrieMap.hs
compiler/simplStg/RepType.hs
compiler/typecheck/TcCanonical.hs
compiler/typecheck/TcErrors.hs
compiler/typecheck/TcForeign.hs
compiler/typecheck/TcGenFunctor.hs
compiler/typecheck/TcHsType.hs
compiler/typecheck/TcInteract.hs
compiler/typecheck/TcType.hs
compiler/typecheck/TcTypeable.hs
compiler/typecheck/TcUnify.hs
compiler/typecheck/TcValidity.hs
compiler/types/Kind.hs
compiler/types/Type.hs
compiler/types/Type.hs-boot
compiler/types/Unify.hs
testsuite/tests/roles/should_compile/Roles14.stderr
testsuite/tests/roles/should_compile/Roles3.stderr
testsuite/tests/roles/should_compile/Roles4.stderr
testsuite/tests/roles/should_compile/T8958.stderr
testsuite/tests/typecheck/should_run/T11715.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_run/T11715.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_run/TypeOf.stdout
testsuite/tests/typecheck/should_run/TypeRep.stdout
testsuite/tests/typecheck/should_run/all.T