Fix #16293 by cleaning up Proxy# infelicities
authorRyan Scott <ryan.gl.scott@gmail.com>
Sat, 9 Feb 2019 14:50:42 +0000 (09:50 -0500)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Tue, 12 Feb 2019 07:50:03 +0000 (02:50 -0500)
commit012257c15f584069500af2953ab70856f9a1470e
treee6822fee11572b3d04194da8c14b6e7f3794519d
parent6399965d7f1636db6c777f597192467f93d800b1
Fix #16293 by cleaning up Proxy# infelicities

This bug fixes three problems related to `Proxy#`/`proxy#`:

1. Reifying it with TH claims that the `Proxy#` type constructor has
   two arguments, but that ought to be one for consistency with
   TH's treatment for other primitive type constructors like `(->)`.
   This was fixed by just returning the number of
   `tyConVisibleTyVars` instead of using `tyConArity` (which includes
   invisible arguments).
2. The role of `Proxy#`'s visible argument was hard-coded as nominal.
   Easily fixed by changing it to phantom.
3. The visibility of `proxy#`'s kind argument was specified, which
   is different from the `Proxy` constructor (which treats it as
   inferred). Some minor refactoring in `proxyHashId` fixed ths up.

   Along the way, I had to introduce a `mkSpecForAllTy` function, so
   I did some related Haddock cleanup in `Type`, where that function
   lives.
compiler/basicTypes/MkId.hs
compiler/prelude/TysPrim.hs
compiler/typecheck/TcSplice.hs
compiler/types/Type.hs
testsuite/tests/primops/should_compile/T16293a.hs [new file with mode: 0644]
testsuite/tests/primops/should_compile/all.T
testsuite/tests/th/T16293b.hs [new file with mode: 0644]
testsuite/tests/th/all.T