FixityEnv, FixItem(..), lookupFixity, emptyFixityEnv,
- implicitTyThings, isImplicitTyThing,
+ implicitTyThings,
TyThing(..), tyThingClass, tyThingTyCon, tyThingDataCon, tyThingId,
TypeEnv, lookupType, mkTypeEnv, emptyTypeEnv,
Dependencies(..), noDependencies,
Pool(..), emptyPool, DeclPool, InstPool,
Gated,
- RulePool, addRuleToPool,
+ RulePool, RulePoolContents, addRuleToPool,
NameCache(..), OrigNameCache, OrigIParamCache,
Avails, availsToNameSet, availName, availNames,
GenAvailInfo(..), AvailInfo, RdrAvailInfo,
import InstEnv ( InstEnv, DFunId )
import Rules ( RuleBase )
import CoreSyn ( CoreBind )
-import Id ( Id, isImplicitId )
+import Id ( Id )
import Type ( TyThing(..) )
import Class ( Class, classSelIds, classTyCon )
import PrelNames ( isBuiltInSyntaxName )
import Maybes ( orElse )
import Outputable
-import SrcLoc ( SrcLoc )
+import SrcLoc ( SrcSpan )
import UniqSupply ( UniqSupply )
import Maybe ( fromJust )
import FastString ( FastString )
data ModGuts
= ModGuts {
mg_module :: !Module,
- mg_exports :: !Avails, -- What it exports
+ mg_exports :: !NameSet, -- What it exports
mg_deps :: !Dependencies, -- What is below it, directly or otherwise
mg_dir_imps :: ![Module], -- Directly-imported modules; used to
-- generate initialisation code
%************************************************************************
\begin{code}
-isImplicitTyThing :: TyThing -> Bool
-isImplicitTyThing (ADataCon dc) = True
-isImplicitTyThing (AnId id) = isImplicitId id
-isImplicitTyThing (ATyCon tc) = isClassTyCon tc
-isImplicitTyThing other = False
-
implicitTyThings :: TyThing -> [TyThing]
implicitTyThings (AnId id) = []
type FixityEnv = NameEnv FixItem
-- We keep the OccName in the range so that we can generate an interface from it
-data FixItem = FixItem OccName Fixity SrcLoc
+data FixItem = FixItem OccName Fixity SrcSpan
instance Outputable FixItem where
ppr (FixItem occ fix loc) = ppr fix <+> ppr occ <+> parens (ppr loc)
-- available before this instance decl is needed.
eps_rules :: !RulePool
- -- Rules move from here to eps_rule_base when
- -- all their LHS free vars are in the eps_PTE
- -- To maintain this invariant, we need to check the pool
- -- a) when adding to the rule pool by loading an interface
- -- (some of the new rules may alrady have all their
- -- gates in the eps_PTE)
- -- b) when extending the eps_PTE when we load a decl
- -- from the eps_decls pool
+ -- The as-yet un-slurped rules
}
\end{code}
\end{code}
\begin{code}
-data Pool p = Pool (NameEnv p) -- The pool itself, indexed by some primary key
+data Pool p = Pool p -- The pool itself
Int -- Number of decls slurped into the map
Int -- Number of decls slurped out of the map
-emptyPool = Pool emptyNameEnv 0 0
+emptyPool p = Pool p 0 0
instance Outputable p => Outputable (Pool p) where
ppr (Pool p n_in n_out) -- Debug printing only
= vcat [ptext SLIT("Pool") <+> int n_in <+> int n_out,
nest 2 (ppr p)]
-type DeclPool = Pool IfaceDecl
+type DeclPool = Pool (NameEnv IfaceDecl) -- Keyed by the "main thing" of the decl
-------------------------
type Gated d = ([Name], (ModuleName, d)) -- The [Name] 'gate' the declaration
-- ModuleName records which iface file this
-- decl came from
-type RulePool = Pool [Gated IfaceRule]
+type RulePool = Pool RulePoolContents
+type RulePoolContents = [Gated IfaceRule]
-addRuleToPool :: NameEnv [Gated IfaceRule]
+addRuleToPool :: RulePoolContents
-> (ModuleName, IfaceRule)
-> [Name] -- Free vars of rule; always non-empty
- -> NameEnv [Gated IfaceRule]
-addRuleToPool rules rule (fv:fvs) = extendNameEnv_C combine rules fv [(fvs,rule)]
- where
- combine old _ = (fvs,rule) : old
+ -> RulePoolContents
+addRuleToPool rules rule fvs = (fvs,rule) : rules
-------------------------
-type InstPool = Pool [Gated IfaceInst]
+type InstPool = Pool (NameEnv [Gated IfaceInst])
-- The key of the Pool is the Class
-- The Names are the TyCons in the instance head
-- For example, suppose this is in an interface file