summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2020-10-10 17:03:02 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-15 04:30:27 -0400
commit51c4b851965abdece2f88f8e583256e15f3140fe (patch)
tree56c31e593bc53664514628d5bcdea822880b62d1
parent0c4bfed849d454bee707fcb2989eb7c6339eaedb (diff)
downloadhaskell-51c4b851965abdece2f88f8e583256e15f3140fe.tar.gz
Remove Proxy# argument in Data.Typeable.Internal
No longer neccessary - TypeRep is now indexed, there is no ambiguity. Also fix a comment in Evidence.hs, IsLabel no longer takes a Proxy#.
-rw-r--r--compiler/GHC/HsToCore/Binds.hs10
-rw-r--r--compiler/GHC/Tc/Instance/Class.hs2
-rw-r--r--compiler/GHC/Tc/Types/Evidence.hs2
-rw-r--r--libraries/base/Data/Typeable/Internal.hs8
-rw-r--r--libraries/base/GHC/Exception.hs-boot2
5 files changed, 11 insertions, 13 deletions
diff --git a/compiler/GHC/HsToCore/Binds.hs b/compiler/GHC/HsToCore/Binds.hs
index cb9df758d0..10534c782b 100644
--- a/compiler/GHC/HsToCore/Binds.hs
+++ b/compiler/GHC/HsToCore/Binds.hs
@@ -55,7 +55,6 @@ import GHC.Core.Coercion
import GHC.Core.Multiplicity
import GHC.Builtin.Types ( naturalTy, typeSymbolKind )
import GHC.Types.Id
-import GHC.Types.Id.Make(proxyHashId)
import GHC.Types.Name
import GHC.Types.Var.Set
import GHC.Core.Rules
@@ -1219,7 +1218,7 @@ dsEvTerm (EvFun { et_tvs = tvs, et_given = given
dsEvTypeable :: Type -> EvTypeable -> DsM CoreExpr
-- Return a CoreExpr :: Typeable ty
-- This code is tightly coupled to the representation
--- of TypeRep, in base library Data.Typeable.Internals
+-- of TypeRep, in base library Data.Typeable.Internal
dsEvTypeable ty ev
= do { tyCl <- dsLookupTyCon typeableClassName -- Typeable
; let kind = typeKind ty
@@ -1298,14 +1297,13 @@ ds_ev_typeable ty (EvTypeableTyLit ev)
= -- See Note [Typeable for Nat and Symbol] in GHC.Tc.Solver.Interact
do { fun <- dsLookupGlobalId tr_fun
; dict <- dsEvTerm ev -- Of type KnownNat/KnownSymbol
- ; let proxy = mkTyApps (Var proxyHashId) [ty_kind, ty]
- ; return (mkApps (mkTyApps (Var fun) [ty]) [ dict, proxy ]) }
+ ; return (mkApps (mkTyApps (Var fun) [ty]) [ dict ]) }
where
ty_kind = typeKind ty
-- tr_fun is the Name of
- -- typeNatTypeRep :: KnownNat a => Proxy# a -> TypeRep a
- -- of typeSymbolTypeRep :: KnownSymbol a => Proxy# a -> TypeRep a
+ -- typeNatTypeRep :: KnownNat a => TypeRep a
+ -- of typeSymbolTypeRep :: KnownSymbol a => TypeRep a
tr_fun | ty_kind `eqType` naturalTy = typeNatTypeRepName
| ty_kind `eqType` typeSymbolKind = typeSymbolTypeRepName
| otherwise = panic "dsEvTypeable: unknown type lit kind"
diff --git a/compiler/GHC/Tc/Instance/Class.hs b/compiler/GHC/Tc/Instance/Class.hs
index 639a9e6cf1..94a170692a 100644
--- a/compiler/GHC/Tc/Instance/Class.hs
+++ b/compiler/GHC/Tc/Instance/Class.hs
@@ -548,7 +548,7 @@ have this instance, implemented here by doTyLit:
instance KnownNat n => Typeable (n :: Nat) where
typeRep = typeNatTypeRep @n
where
- Data.Typeable.Internals.typeNatTypeRep :: KnownNat a => TypeRep a
+ Data.Typeable.Internal.typeNatTypeRep :: KnownNat a => TypeRep a
Ultimately typeNatTypeRep uses 'natSing' from KnownNat to get a
runtime value 'n'; it turns it into a string with 'show' and uses
diff --git a/compiler/GHC/Tc/Types/Evidence.hs b/compiler/GHC/Tc/Types/Evidence.hs
index 8060194d10..f44f10b3a6 100644
--- a/compiler/GHC/Tc/Types/Evidence.hs
+++ b/compiler/GHC/Tc/Types/Evidence.hs
@@ -1022,7 +1022,7 @@ instance Outputable EvTypeable where
-- overloaded-label dictionary to expose the underlying value. We
-- expect the 'Type' to have the form `IP sym ty` or `IsLabel sym ty`,
-- and return a 'Coercion' `co :: IP sym ty ~ ty` or
--- `co :: IsLabel sym ty ~ Proxy# sym -> ty`. See also
+-- `co :: IsLabel sym ty ~ ty`. See also
-- Note [Type-checking overloaded labels] in "GHC.Tc.Gen.Expr".
unwrapIP :: Type -> CoercionR
unwrapIP ty =
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index 81cd3caf22..85abebf331 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -979,12 +979,12 @@ mkTypeLitTyCon name kind_tycon
where kind = KindRepTyConApp kind_tycon []
-- | Used to make `'Typeable' instance for things of kind Nat
-typeNatTypeRep :: KnownNat a => Proxy# a -> TypeRep a
-typeNatTypeRep p = typeLitTypeRep (show (natVal' p)) tcNat
+typeNatTypeRep :: forall a. KnownNat a => TypeRep a
+typeNatTypeRep = typeLitTypeRep (show (natVal' (proxy# @a))) tcNat
-- | Used to make `'Typeable' instance for things of kind Symbol
-typeSymbolTypeRep :: KnownSymbol a => Proxy# a -> TypeRep a
-typeSymbolTypeRep p = typeLitTypeRep (show (symbolVal' p)) tcSymbol
+typeSymbolTypeRep :: forall a. KnownSymbol a => TypeRep a
+typeSymbolTypeRep = typeLitTypeRep (show (symbolVal' (proxy# @a))) tcSymbol
mkTypeLitFromString :: TypeLitSort -> String -> SomeTypeRep
mkTypeLitFromString TypeLitSymbol s =
diff --git a/libraries/base/GHC/Exception.hs-boot b/libraries/base/GHC/Exception.hs-boot
index 4507b20790..86502c9ae6 100644
--- a/libraries/base/GHC/Exception.hs-boot
+++ b/libraries/base/GHC/Exception.hs-boot
@@ -14,7 +14,7 @@ More dramatically
GHC.Exception
imports Data.Typeable
-imports Data.Typeable.Internals
+imports Data.Typeable.Internal
imports GHC.Arr (fingerprint representation etc)
imports GHC.Real
imports {-# SOURCE #-} GHC.Exception