[GHC] #10348: HEAD: `KnownNat` does not imply `Typeable` any more
GHC
ghc-devs at haskell.org
Tue Jun 16 14:58:41 UTC 2015
#10348: HEAD: `KnownNat` does not imply `Typeable` any more
-------------------------------------+-------------------------------------
Reporter: heisenbug | Owner: diatchki
Type: bug | Status: new
Priority: highest | Milestone: 7.12.1
Component: Compiler (Type | Version: 7.11
checker) | Keywords:
Resolution: | Architecture:
Operating System: Unknown/Multiple | Unknown/Multiple
Type of failure: GHC rejects | Test Case:
valid program | Blocking:
Blocked By: | Differential Revisions:
Related Tickets: |
-------------------------------------+-------------------------------------
Comment (by heisenbug):
I changed the test case thus:
{{{
diff --git a/testsuite/tests/typecheck/should_compile/T10348.hs
b/testsuite/tests/typecheck/should_compile/T10348.hs
index 213079b..14fc085 100644
--- a/testsuite/tests/typecheck/should_compile/T10348.hs
+++ b/testsuite/tests/typecheck/should_compile/T10348.hs
@@ -15,8 +15,7 @@ data T t where
deriving instance Show (T n)
-hey :: (Typeable n, KnownNat n) => T (Foo n)
--- SHOULD BE: hey :: KnownNat n => T (Foo n)
+hey :: KnownNat n => T (Foo n)
hey = T Hey
ho :: T (Foo 42)
}}}
Then this code (I just added a panic for visibility) is triggered:
{{{
diff --git a/compiler/typecheck/TcInteract.hs
b/compiler/typecheck/TcInteract.hs
index 01b0ba1..bf5f237 100644
--- a/compiler/typecheck/TcInteract.hs
+++ b/compiler/typecheck/TcInteract.hs
@@ -48,6 +48,7 @@ import Pair (Pair(..))
import Unique( hasKey )
import DynFlags
import Util
+import TypeRep( Type(..) )
{-
**********************************************************************
@@ -1852,6 +1853,8 @@ matchTypeableClass clas _k t
| Just (f,kt) <- splitAppTy_maybe t = doTyApp f kt
| Just _ <- isNumLitTy t = mkSimpEv
(EvTypeableTyLit t)
| Just _ <- isStrLitTy t = mkSimpEv
(EvTypeableTyLit t)
+ | TyConApp con [] <- _k
+ , Just tcon <- isPromotedTyCon_maybe con = pprPanic
"matchTypeableClass" $ ppr tcon
| otherwise = return NoInstance
where
}}}
I guess code must be generated that creates the Typeable hash on the fly
(at runtime) by appealing to the KnownNat's method.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10348#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list