summaryrefslogtreecommitdiff
path: root/libraries/base/Data
diff options
context:
space:
mode:
authorRichard Eisenberg <eir@cis.upenn.edu>2016-02-04 10:42:56 -0500
committerRichard Eisenberg <eir@cis.upenn.edu>2016-02-24 13:31:30 -0500
commitd8c64e86361f6766ebe26a262bb229fb8301a42a (patch)
tree94d68ebcb1cc6e9eabff08d3cd1d7e61dd99c01e /libraries/base/Data
parentce36115b369510c51f402073174d82d0d1244589 (diff)
downloadhaskell-wip/runtime-rep.tar.gz
Address #11471 by putting RuntimeRep in kinds.wip/runtime-rep
See Note [TYPE] in TysPrim. There are still some outstanding pieces in #11471 though, so this doesn't actually nail the bug. This commit also contains a few performance improvements: * Short-cut equality checking of nullary type syns * Compare types before kinds in eqType * INLINE coreViewOneStarKind * Store tycon binders separately from kinds. This resulted in a ~10% performance improvement in compiling the Cabal package. No change in functionality other than performance. (This affects the interface file format, though.) This commit updates the haddock submodule.
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 " -> " .