[commit: ghc] wip/ttypeable: Move special tycons (5f3d10f)
git at git.haskell.org
git at git.haskell.org
Fri Jul 8 14:31:10 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/ttypeable
Link : http://ghc.haskell.org/trac/ghc/changeset/5f3d10f9bd795fc264e8c7962cc8d96f6bc92a7e/ghc
>---------------------------------------------------------------
commit 5f3d10f9bd795fc264e8c7962cc8d96f6bc92a7e
Author: Ben Gamari <ben at smart-cactus.org>
Date: Wed Mar 16 17:51:01 2016 +0100
Move special tycons
>---------------------------------------------------------------
5f3d10f9bd795fc264e8c7962cc8d96f6bc92a7e
compiler/prelude/TysPrim.hs | 16 +++++++++++++++-
compiler/typecheck/TcTypeable.hs | 18 +++---------------
2 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs
index 376a0bb..1e81004 100644
--- a/compiler/prelude/TysPrim.hs
+++ b/compiler/prelude/TysPrim.hs
@@ -31,6 +31,7 @@ module TysPrim(
funTyCon, funTyConName,
primTyCons,
+ primTypeableTyCons,
charPrimTyCon, charPrimTy,
intPrimTyCon, intPrimTy,
@@ -80,7 +81,7 @@ module TysPrim(
#include "HsVersions.h"
import {-# SOURCE #-} TysWiredIn
- ( runtimeRepTy, liftedTypeKind
+ ( runtimeRepTyCon, runtimeRepTy, liftedTypeKind
, vecRepDataConTyCon, ptrRepUnliftedDataConTyCon
, voidRepDataConTy, intRepDataConTy
, wordRepDataConTy, int64RepDataConTy, word64RepDataConTy, addrRepDataConTy
@@ -94,6 +95,7 @@ import {-# SOURCE #-} TysWiredIn
import Var ( TyVar, mkTyVar )
import Name
+import NameEnv
import TyCon
import SrcLoc
import Unique
@@ -155,6 +157,18 @@ primTyCons
#include "primop-vector-tycons.hs-incl"
]
+-- | The names of the 'TyCon's which we define 'Typeable' bindings for
+-- explicitly in "Data.Typeable.Internal"
+-- and should not generate bindings for in "GHC.Types".
+--
+-- See Note [Mutually recursive representations of primitive types]
+primTypeableTyCons :: NameEnv TyConRepName
+primTypeableTyCons = mkNameEnv
+ [ (tYPETyConName, trTYPEName)
+ , (tyConName runtimeRepTyCon, trRuntimeRepName)
+ , (funTyConName, trArrowName)
+ ]
+
mkPrimTc :: FastString -> Unique -> TyCon -> Name
mkPrimTc fs unique tycon
= mkWiredInName gHC_PRIM (mkTcOccFS fs)
diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs
index cb79e08..061d22f 100644
--- a/compiler/typecheck/TcTypeable.hs
+++ b/compiler/typecheck/TcTypeable.hs
@@ -13,8 +13,7 @@ import IfaceEnv( newGlobalBinder )
import TcEnv
import TcRnMonad
import PrelNames
-import TysPrim ( primTyCons, tYPETyConName, funTyConName )
-import TysWiredIn ( runtimeRepTyCon )
+import TysPrim ( primTyCons, primTypeableTyCons )
import Id
import Type
import TyCon
@@ -22,7 +21,7 @@ import DataCon
import Name( getOccName )
import OccName
import Module
-import NameSet
+import NameEnv
import HsSyn
import DynFlags
import Bag
@@ -168,17 +167,6 @@ mkTypeableTyConBinds tycons
; gbl_env <- tcExtendGlobalValEnv tycon_rep_ids getGblEnv
; return (gbl_env `addTypecheckedBinds` tc_binds) }
--- | The names of the 'TyCon's which we handle explicitly in "Data.Typeable.Internal"
--- and should not generate bindings for in "GHC.Types".
---
--- See Note [Mutually recursive representations of primitive types]
-specialPrimTyCons :: NameSet
-specialPrimTyCons = mkNameSet
- [ tYPETyConName
- , tyConName runtimeRepTyCon
- , funTyConName
- ]
-
-- | Generate bindings for the type representation of a wired-in TyCon defined
-- by the virtual "GHC.Prim" module. This is where we inject the representation
-- bindings for primitive types into "GHC.Types"
@@ -223,7 +211,7 @@ ghcPrimTypeableBinds stuff
all_prim_tys :: [TyCon]
all_prim_tys = [ tc' | tc <- funTyCon : primTyCons
, tc' <- tc : tyConATs tc
- , not $ tyConName tc' `elemNameSet` specialPrimTyCons
+ , not $ tyConName tc' `elemNameEnv` primTypeableTyCons
]
mkBind :: TyCon -> LHsBinds Id
More information about the ghc-commits
mailing list