From 012257c15f584069500af2953ab70856f9a1470e Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Sat, 9 Feb 2019 09:50:42 -0500 Subject: 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. --- testsuite/tests/th/T16293b.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 testsuite/tests/th/T16293b.hs (limited to 'testsuite/tests/th/T16293b.hs') diff --git a/testsuite/tests/th/T16293b.hs b/testsuite/tests/th/T16293b.hs new file mode 100644 index 0000000000..85affa5204 --- /dev/null +++ b/testsuite/tests/th/T16293b.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE TemplateHaskell #-} +module T16293b where + +import Control.Monad +import GHC.Exts +import Language.Haskell.TH + +f :: () +f = $(do PrimTyConI _ arity _ <- reify ''Proxy# + unless (arity == 1) $ + fail $ "Unexpected arity for Proxy#: " ++ show arity + [| () |]) -- cgit v1.2.1