summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorIavor S. Diatchki <diatchki@galois.com>2014-06-16 15:58:49 -0700
committerIavor S. Diatchki <diatchki@galois.com>2014-06-16 15:58:49 -0700
commit836981c7dec5c794ca94408468535cc018dc2e82 (patch)
treebde0a9193a188379651e4e3665e009caeb113a49 /libraries
parente09be5ff6e92593ba8e1202b1574a62a17b329ba (diff)
downloadhaskell-836981c7dec5c794ca94408468535cc018dc2e82.tar.gz
Redo instance to be more efficient (see #8778, #9203)
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/Data/Typeable/Internal.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index eae2109158..5b1cde4347 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -423,8 +423,9 @@ deriving instance Typeable Typeable
-- Instances for type literals
instance KnownNat n => Typeable (n :: Nat) where
- typeRep# p = mkTyConApp tc []
+ typeRep# = \_ -> rep
where
+ rep = mkTyConApp tc []
tc = TyCon
{ tyConHash = fingerprintString (mk pack modu nm)
, tyConPackage = pack
@@ -433,13 +434,14 @@ instance KnownNat n => Typeable (n :: Nat) where
}
pack = "base"
modu = "GHC.TypeLits"
- nm = show (natVal' p)
+ nm = show (natVal' (proxy# :: Proxy# n))
mk a b c = a ++ " " ++ b ++ " " ++ c
instance KnownSymbol s => Typeable (s :: Symbol) where
- typeRep# p = mkTyConApp tc []
+ typeRep# = \_ -> rep
where
+ rep = mkTyConApp tc []
tc = TyCon
{ tyConHash = fingerprintString (mk pack modu nm)
, tyConPackage = pack
@@ -448,6 +450,6 @@ instance KnownSymbol s => Typeable (s :: Symbol) where
}
pack = "base"
modu = "GHC.TypeLits"
- nm = show (symbolVal' p)
+ nm = show (symbolVal' (proxy# :: Proxy# s))
mk a b c = a ++ " " ++ b ++ " " ++ c