summaryrefslogtreecommitdiff
path: root/libraries/base/Data
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/base/Data')
-rw-r--r--libraries/base/Data/Data.hs2
-rw-r--r--libraries/base/Data/Typeable/Internal.hs28
2 files changed, 14 insertions, 16 deletions
diff --git a/libraries/base/Data/Data.hs b/libraries/base/Data/Data.hs
index 88191c1011..cc94bac30f 100644
--- a/libraries/base/Data/Data.hs
+++ b/libraries/base/Data/Data.hs
@@ -114,7 +114,7 @@ import Data.Monoid
import Data.Ord
import Data.Typeable
import Data.Version( Version(..) )
-import GHC.Base hiding (Any)
+import GHC.Base hiding (Any, IntRep, FloatRep)
import GHC.List
import GHC.Num
import GHC.Read
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index efec62f7d8..87e5c88c76 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -10,6 +10,7 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE UndecidableInstances #-}
+{-# LANGUAGE TypeApplications #-}
-----------------------------------------------------------------------------
-- |
@@ -249,18 +250,6 @@ tyConOf = typeRepTyCon . typeRep
tcFun :: TyCon
tcFun = tyConOf (Proxy :: Proxy (Int -> Int))
-tcList :: TyCon
-tcList = tyConOf (Proxy :: Proxy [])
-
-tcTYPE :: TyCon
-tcTYPE = tyConOf (Proxy :: Proxy TYPE)
-
-tc'Lifted :: TyCon
-tc'Lifted = tyConOf (Proxy :: Proxy 'Lifted)
-
-tc'Unlifted :: TyCon
-tc'Unlifted = tyConOf (Proxy :: Proxy 'Unlifted)
-
-- | Adds a TypeRep argument to a TypeRep.
mkAppTy :: TypeRep -> TypeRep -> TypeRep
{-# INLINE mkAppTy #-}
@@ -364,10 +353,19 @@ instance Show TypeRep where
showsPrec p (TypeRep _ tycon kinds tys) =
case tys of
[] -> showsPrec p tycon
- [x@(TypeRep _ argCon _ _)]
+ [x]
| tycon == tcList -> showChar '[' . shows x . showChar ']'
- | tycon == tcTYPE && argCon == tc'Lifted -> showChar '*'
- | tycon == tcTYPE && argCon == tc'Unlifted -> showChar '#'
+ where
+ tcList = tyConOf @[] Proxy
+ [TypeRep _ ptrRepCon _ []]
+ | tycon == tcTYPE && ptrRepCon == tc'PtrRepLifted
+ -> showChar '*'
+ | tycon == tcTYPE && ptrRepCon == tc'PtrRepUnlifted
+ -> showChar '#'
+ where
+ tcTYPE = tyConOf @TYPE Proxy
+ tc'PtrRepLifted = tyConOf @'PtrRepLifted Proxy
+ tc'PtrRepUnlifted = tyConOf @'PtrRepUnlifted Proxy
[a,r] | tycon == tcFun -> showParen (p > 8) $
showsPrec 9 a .
showString " -> " .