Compiles most of the Prelude; versioning still not good
PersistentLinkerState{-abstractly!-}, emptyPLS )
where
PersistentLinkerState{-abstractly!-}, emptyPLS )
where
import Interpreter
import CmStaticInfo ( PackageConfigInfo )
import Module ( ModuleName, PackageName )
import Outputable ( SDoc )
import Interpreter
import CmStaticInfo ( PackageConfigInfo )
import Module ( ModuleName, PackageName )
import Outputable ( SDoc )
-import FiniteMap ( emptyFM )
import Digraph ( SCC(..), flattenSCC )
import Outputable
import Panic ( panic )
import Digraph ( SCC(..), flattenSCC )
import Outputable
import Panic ( panic )
ppr (LP package_nm) = text "LinkableP" <+> ptext package_nm
emptyPLS :: IO PersistentLinkerState
ppr (LP package_nm) = text "LinkableP" <+> ptext package_nm
emptyPLS :: IO PersistentLinkerState
-#ifdef GHCI
-emptyPLS = return (PersistentLinkerState { closure_env = emptyFM,
- itbl_env = emptyFM })
-#else
-emptyPLS = return (PersistentLinkerState {})
-#endif
+emptyPLS = return (PersistentLinkerState { closure_env = emptyClosureEnv,
+ itbl_env = emptyItblEnv })
type ItblEnv = FiniteMap RdrName (Ptr StgInfoTable)
type ClosureEnv = FiniteMap RdrName HValue
type ItblEnv = FiniteMap RdrName (Ptr StgInfoTable)
type ClosureEnv = FiniteMap RdrName HValue
+emptyClosureEnv = emptyFM
-- ---------------------------------------------------------------------------
-- Run our STG program through the interpreter
-- ---------------------------------------------------------------------------
-- Run our STG program through the interpreter
import Rules ( emptyRuleBase )
import PrelInfo ( wiredInThingEnv, wiredInThings )
import PrelNames ( knownKeyNames )
import Rules ( emptyRuleBase )
import PrelInfo ( wiredInThingEnv, wiredInThings )
import PrelNames ( knownKeyNames )
-import PrelRules ( builtinRules )
import MkIface ( completeIface, mkModDetailsFromIface, mkModDetails,
writeIface )
import TcModule ( TcResults(..), typecheckModule )
import MkIface ( completeIface, mkModDetailsFromIface, mkModDetails,
writeIface )
import TcModule ( TcResults(..), typecheckModule )
import Bag ( emptyBag )
import Outputable
import Bag ( emptyBag )
import Outputable
+import Interpreter ( UnlinkedIBind, ItblEnv, stgToInterpSyn )
import HscStats ( ppSourceStats )
import HscTypes ( ModDetails, ModIface(..), PersistentCompilerState(..),
PersistentRenamerState(..), ModuleLocation(..),
import HscStats ( ppSourceStats )
import HscTypes ( ModDetails, ModIface(..), PersistentCompilerState(..),
PersistentRenamerState(..), ModuleLocation(..),
-- TYPECHECK
maybe_tc_result
-- TYPECHECK
maybe_tc_result
- <- typecheckModule dflags this_mod pcs_cl hst hit cl_hs_decls;
+ <- typecheckModule dflags this_mod pcs_cl hst old_iface cl_hs_decls;
case maybe_tc_result of {
Nothing -> return (HscFail pcs_cl);
Just tc_result -> do {
case maybe_tc_result of {
Nothing -> return (HscFail pcs_cl);
Just tc_result -> do {
-- TYPECHECK
show_pass dflags "Typechecker";
maybe_tc_result
-- TYPECHECK
show_pass dflags "Typechecker";
maybe_tc_result
- <- typecheckModule dflags this_mod pcs_rn hst hit rn_hs_decls;
+ <- typecheckModule dflags this_mod pcs_rn hst new_iface rn_hs_decls;
case maybe_tc_result of {
Nothing -> do { hPutStrLn stderr "Typechecked failed"
; return (HscFail pcs_rn) } ;
case maybe_tc_result of {
Nothing -> do { hPutStrLn stderr "Typechecked failed"
; return (HscFail pcs_rn) } ;
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
--- $Id: Interpreter.hs,v 1.2 2000/11/08 13:51:58 simonmar Exp $
+-- $Id: Interpreter.hs,v 1.3 2000/11/08 14:52:06 simonpj Exp $
--
-- Interpreter subsystem wrapper
--
--
-- Interpreter subsystem wrapper
--
module InterpSyn,
module Linker
#else
module InterpSyn,
module Linker
#else
+ ClosureEnv, emptyClosureEnv,
+ ItblEnv, emptyItblEnv,
linkIModules,
stgToInterpSyn,
HValue,
linkIModules,
stgToInterpSyn,
HValue,
+
+---------------------------------------------
+-- YES! We have an interpreter
+---------------------------------------------
+
import StgInterp
import InterpSyn
import Linker
import StgInterp
import InterpSyn
import Linker
+
+import Outputable
+
+---------------------------------------------
+-- NO! No interpreter; generate stubs for all the bits
+---------------------------------------------
+
-linkIModules = error "linkIModules"
-stgToInterpSyn = error "linkIModules"
-type HValue = ()
-type UnlinkedIBind = ()
-loadObjs = error "loadObjs"
-resolveObjs = error "loadObjs"
+emptyItblEnv = ()
+
+type HValue = ()
+data UnlinkedIBind = UnlinkedIBind
+
+instance Outputable UnlinkedIBind where
+ ppr x = text "Can't output UnlinkedIBind"
+
+linkIModules = error "linkIModules"
+stgToInterpSyn = error "linkIModules"
+loadObjs = error "loadObjs"
+resolveObjs = error "loadObjs"
getInterfaceExports, closeDecls,
RecompileRequired, outOfDate, recompileRequired
)
getInterfaceExports, closeDecls,
RecompileRequired, outOfDate, recompileRequired
)
-import RnHiFiles ( readIface, removeContext,
+import RnHiFiles ( readIface, removeContext, loadInterface,
loadExports, loadFixDecls, loadDeprecs )
loadExports, loadFixDecls, loadDeprecs )
-import RnEnv ( availsToNameSet,
+import RnEnv ( availsToNameSet, availName,
emptyAvailEnv, unitAvailEnv, availEnvElts, plusAvailEnv, groupAvails,
warnUnusedImports, warnUnusedLocalBinds, warnUnusedModules,
lookupOrigNames, lookupSrcName, newGlobalName
emptyAvailEnv, unitAvailEnv, availEnvElts, plusAvailEnv, groupAvails,
warnUnusedImports, warnUnusedLocalBinds, warnUnusedModules,
lookupOrigNames, lookupSrcName, newGlobalName
mkModuleInThisPackage, mkModuleName, moduleEnvElts
)
import Name ( Name, NamedThing(..), getSrcLoc,
mkModuleInThisPackage, mkModuleName, moduleEnvElts
)
import Name ( Name, NamedThing(..), getSrcLoc,
- nameIsLocalOrFrom,
- nameOccName, nameModule,
+ nameIsLocalOrFrom, nameOccName, nameModule,
)
import Name ( mkNameEnv, nameEnvElts, extendNameEnv )
)
import Name ( mkNameEnv, nameEnvElts, extendNameEnv )
-import RdrName ( elemRdrEnv, foldRdrEnv, isQual )
+import RdrName ( rdrEnvToList, elemRdrEnv, foldRdrEnv, isQual )
import OccName ( occNameFlavour )
import NameSet
import TysWiredIn ( unitTyCon, intTyCon, boolTyCon )
import OccName ( occNameFlavour )
import NameSet
import TysWiredIn ( unitTyCon, intTyCon, boolTyCon )
ModIface(..), WhatsImported(..),
VersionInfo(..), ImportVersion,
IfaceDecls, mkIfaceDecls, dcl_tycl, dcl_rules, dcl_insts,
ModIface(..), WhatsImported(..),
VersionInfo(..), ImportVersion,
IfaceDecls, mkIfaceDecls, dcl_tycl, dcl_rules, dcl_insts,
- GlobalRdrEnv, AvailEnv, GenAvailInfo(..), AvailInfo,
+ GlobalRdrEnv, AvailEnv, GenAvailInfo(..), AvailInfo, Avails,
Provenance(..), ImportReason(..), initialVersionInfo,
Deprecations(..), lookupDeprec, lookupIface
)
Provenance(..), ImportReason(..), initialVersionInfo,
Deprecations(..), lookupDeprec, lookupIface
)
-- SLURP IN ALL THE NEEDED DECLARATIONS
implicitFVs mod_name rn_local_decls `thenRn` \ implicit_fvs ->
let
-- SLURP IN ALL THE NEEDED DECLARATIONS
implicitFVs mod_name rn_local_decls `thenRn` \ implicit_fvs ->
let
- slurp_fvs = implicit_fvs `plusFV` source_fvs
+ slurp_fvs = implicit_fvs `plusFV` source_fvs
-- It's important to do the "plus" this way round, so that
-- when compiling the prelude, locally-defined (), Bool, etc
-- override the implicit ones.
-- It's important to do the "plus" this way round, so that
-- when compiling the prelude, locally-defined (), Bool, etc
-- override the implicit ones.
mi_deprecs = my_deprecs,
mi_decls = panic "mi_decls"
}
mi_deprecs = my_deprecs,
mi_decls = panic "mi_decls"
}
-
- -- The export_fvs make the exported names look just as if they
- -- occurred in the source program.
- -- We only need the 'parent name' of the avail;
- -- that's enough to suck in the declaration.
- export_fvs = availsToNameSet export_avails
- used_vars = source_fvs `plusFV` export_fvs
-
in
-- REPORT UNUSED NAMES, AND DEBUG DUMP
reportUnusedNames mod_iface imports global_avail_env
in
-- REPORT UNUSED NAMES, AND DEBUG DUMP
reportUnusedNames mod_iface imports global_avail_env
- used_vars rn_imp_decls `thenRn_`
+ source_fvs export_avails rn_imp_decls `thenRn_`
returnRn (Just (mod_iface, final_decls))
where
returnRn (Just (mod_iface, final_decls))
where
loadOldIface parsed_iface
= let iface = parsed_iface
loadOldIface parsed_iface
= let iface = parsed_iface
- in -- RENAME IT
- let mod = pi_mod iface
- doc_str = ptext SLIT("need usage info from") <+> ppr mod
in
initIfaceRnMS mod (
loadHomeDecls (pi_decls iface) `thenRn` \ decls ->
in
initIfaceRnMS mod (
loadHomeDecls (pi_decls iface) `thenRn` \ decls ->
\begin{code}
reportUnusedNames :: ModIface -> [RdrNameImportDecl]
-> AvailEnv
\begin{code}
reportUnusedNames :: ModIface -> [RdrNameImportDecl]
-> AvailEnv
+ -> NameSet -- Used in this module
+ -> Avails -- Exported by this module
-> [RenamedHsDecl]
-> RnMG ()
reportUnusedNames my_mod_iface imports avail_env
-> [RenamedHsDecl]
-> RnMG ()
reportUnusedNames my_mod_iface imports avail_env
- used_names imported_decls
+ source_fvs export_avails imported_decls
= warnUnusedModules unused_imp_mods `thenRn_`
warnUnusedLocalBinds bad_locals `thenRn_`
warnUnusedImports bad_imp_names `thenRn_`
printMinimalImports this_mod minimal_imports `thenRn_`
= warnUnusedModules unused_imp_mods `thenRn_`
warnUnusedLocalBinds bad_locals `thenRn_`
warnUnusedImports bad_imp_names `thenRn_`
printMinimalImports this_mod minimal_imports `thenRn_`
- warnDeprecations this_mod my_deprecs really_used_names `thenRn_`
+ warnDeprecations this_mod export_avails my_deprecs
+ really_used_names `thenRn_`
traceRn (text "Used" <+> fsep (map ppr (nameSetToList used_names))) `thenRn_`
returnRn ()
traceRn (text "Used" <+> fsep (map ppr (nameSetToList used_names))) `thenRn_`
returnRn ()
gbl_env = mi_globals my_mod_iface
my_deprecs = mi_deprecs my_mod_iface
gbl_env = mi_globals my_mod_iface
my_deprecs = mi_deprecs my_mod_iface
+ -- The export_fvs make the exported names look just as if they
+ -- occurred in the source program.
+ export_fvs = availsToNameSet export_avails
+ used_names = source_fvs `plusFV` export_fvs
+
-- Now, a use of C implies a use of T,
-- if C was brought into scope by T(..) or T(C)
really_used_names = used_names `unionNameSets`
-- Now, a use of C implies a use of T,
-- if C was brought into scope by T(..) or T(C)
really_used_names = used_names `unionNameSets`
module_unused :: Module -> Bool
module_unused mod = moduleName mod `elem` unused_imp_mods
module_unused :: Module -> Bool
module_unused mod = moduleName mod `elem` unused_imp_mods
-
-warnDeprecations this_mod my_deprecs used_names
+warnDeprecations this_mod export_avails my_deprecs used_names
= doptRn Opt_WarnDeprecations `thenRn` \ warn_drs ->
if not warn_drs then returnRn () else
= doptRn Opt_WarnDeprecations `thenRn` \ warn_drs ->
if not warn_drs then returnRn () else
- getIfacesRn `thenRn` \ ifaces ->
- getHomeIfaceTableRn `thenRn` \ hit ->
+ -- The home modules for things in the export list
+ -- may not have been loaded yet; do it now, so
+ -- that we can see their deprecations, if any
+ mapRn_ load_home export_mods `thenRn_`
+
+ getIfacesRn `thenRn` \ ifaces ->
+ getHomeIfaceTableRn `thenRn` \ hit ->
let
pit = iPIT ifaces
deprecs = [ (n,txt)
let
pit = iPIT ifaces
deprecs = [ (n,txt)
mapRn_ warnDeprec deprecs
where
mapRn_ warnDeprec deprecs
where
+ export_mods = nub [ moduleName (nameModule name)
+ | avail <- export_avails,
+ let name = availName avail,
+ not (nameIsLocalOrFrom this_mod name) ]
+
+ load_home m = loadInterface (text "Check deprecations for" <+> ppr m) m ImportBySystem
+
lookup_deprec hit pit n
| nameIsLocalOrFrom this_mod n
= lookupDeprec my_deprecs n
lookup_deprec hit pit n
| nameIsLocalOrFrom this_mod n
= lookupDeprec my_deprecs n
stats = vcat
[int n_mods <+> text "interfaces read",
stats = vcat
[int n_mods <+> text "interfaces read",
- hsep [ int n_decls_slurped, text "class decls imported, out of",
+ hsep [ int n_decls_slurped, text "type/class/variable imported, out of",
int (n_decls_slurped + n_decls_left), text "read"],
hsep [ int n_insts_slurped, text "instance decls imported, out of",
int (n_insts_slurped + n_insts_left), text "read"],
int (n_decls_slurped + n_decls_left), text "read"],
hsep [ int n_insts_slurped, text "instance decls imported, out of",
int (n_insts_slurped + n_insts_left), text "read"],
RdrNameEnv, emptyRdrEnv, extendRdrEnv,
addListToRdrEnv, rdrEnvToList, rdrEnvElts
)
RdrNameEnv, emptyRdrEnv, extendRdrEnv,
addListToRdrEnv, rdrEnvToList, rdrEnvElts
)
-import Name ( Name, OccName, NamedThing(..), getSrcLoc,
+import Name ( Name, OccName, NamedThing(..),
nameOccName,
decode, mkLocalName, mkKnownKeyGlobal
)
nameOccName,
decode, mkLocalName, mkKnownKeyGlobal
)
mapRn_ :: (a -> RnM d b) -> [a] -> RnM d ()
mapMaybeRn :: (a -> RnM d (Maybe b)) -> [a] -> RnM d [b]
flatMapRn :: (a -> RnM d [b]) -> [a] -> RnM d [b]
mapRn_ :: (a -> RnM d b) -> [a] -> RnM d ()
mapMaybeRn :: (a -> RnM d (Maybe b)) -> [a] -> RnM d [b]
flatMapRn :: (a -> RnM d [b]) -> [a] -> RnM d [b]
-sequenceRn :: [RnM d a] -> RnM d [a]
+sequenceRn :: [RnM d a] -> RnM d [a]
+sequenceRn_ :: [RnM d a] -> RnM d ()
foldlRn :: (b -> a -> RnM d b) -> b -> [a] -> RnM d b
mapAndUnzipRn :: (a -> RnM d (b,c)) -> [a] -> RnM d ([b],[c])
fixRn :: (a -> RnM d a) -> RnM d a
foldlRn :: (b -> a -> RnM d b) -> b -> [a] -> RnM d b
mapAndUnzipRn :: (a -> RnM d (b,c)) -> [a] -> RnM d ([b],[c])
fixRn :: (a -> RnM d a) -> RnM d a
sequenceRn [] = returnRn []
sequenceRn (m:ms) = m `thenRn` \ r ->
sequenceRn [] = returnRn []
sequenceRn (m:ms) = m `thenRn` \ r ->
- sequenceRn ms `thenRn` \ rs ->
+ sequenceRn ms `thenRn` \ rs ->
+sequenceRn_ [] = returnRn ()
+sequenceRn_ (m:ms) = m `thenRn_` sequenceRn_ ms
+
mapRn f [] = returnRn []
mapRn f (x:xs)
= f x `thenRn` \ r ->
mapRn f [] = returnRn []
mapRn f (x:xs)
= f x `thenRn` \ r ->
-- then you'll get a 'B does not export AType' message. Oh well.
in
-- then you'll get a 'B does not export AType' message. Oh well.
in
- filterImports imp_mod_name import_spec avails `thenRn` \ (filtered_avails, hides, explicits) ->
+ filterImports imp_mod_name from import_spec avails `thenRn` \ (filtered_avails, hides, explicits) ->
let
mk_provenance name = NonLocalDef (UserImport imp_mod iloc (name `elemNameSet` explicits))
let
mk_provenance name = NonLocalDef (UserImport imp_mod iloc (name `elemNameSet` explicits))
\begin{code}
filterImports :: ModuleName -- The module being imported
\begin{code}
filterImports :: ModuleName -- The module being imported
+ -> WhereFrom -- Tells whether it's a {-# SOURCE #-} import
-> Maybe (Bool, [RdrNameIE]) -- Import spec; True => hiding
-> [AvailInfo] -- What's available
-> RnMG ([AvailInfo], -- What's actually imported
-> Maybe (Bool, [RdrNameIE]) -- Import spec; True => hiding
-> [AvailInfo] -- What's available
-> RnMG ([AvailInfo], -- What's actually imported
-- Complains if import spec mentions things that the module doesn't export
-- Warns/informs if import spec contains duplicates.
-- Complains if import spec mentions things that the module doesn't export
-- Warns/informs if import spec contains duplicates.
-filterImports mod Nothing imports
+filterImports mod from Nothing imports
= returnRn (imports, [], emptyNameSet)
= returnRn (imports, [], emptyNameSet)
-filterImports mod (Just (want_hiding, import_items)) total_avails
+filterImports mod from (Just (want_hiding, import_items)) total_avails
= flatMapRn get_item import_items `thenRn` \ avails_w_explicits ->
let
(item_avails, explicits_s) = unzip avails_w_explicits
= flatMapRn get_item import_items `thenRn` \ avails_w_explicits ->
let
(item_avails, explicits_s) = unzip avails_w_explicits
-- they won't make any difference because naked entities like T
-- in an import list map to TcOccs, not VarOccs.
-- they won't make any difference because naked entities like T
-- in an import list map to TcOccs, not VarOccs.
- bale_out item = addErrRn (badImportItemErr mod item) `thenRn_`
+ bale_out item = addErrRn (badImportItemErr mod from item) `thenRn_`
returnRn []
get_item item@(IEModuleContents _) = bale_out item
returnRn []
get_item item@(IEModuleContents _) = bale_out item
%************************************************************************
\begin{code}
%************************************************************************
\begin{code}
-badImportItemErr mod ie
- = sep [ptext SLIT("Module"), quotes (ppr mod),
+badImportItemErr mod from ie
+ = sep [ptext SLIT("Module"), quotes (ppr mod), source_import,
ptext SLIT("does not export"), quotes (ppr ie)]
ptext SLIT("does not export"), quotes (ppr ie)]
+ where
+ source_import = case from of
+ ImportByUserSource -> ptext SLIT("(hi-boot interface)")
+ other -> empty
dodgyImportWarn mod item = dodgyMsg (ptext SLIT("import")) item
dodgyExportWarn item = dodgyMsg (ptext SLIT("export")) item
dodgyImportWarn mod item = dodgyMsg (ptext SLIT("import")) item
dodgyExportWarn item = dodgyMsg (ptext SLIT("export")) item
import Maybes ( maybeToBool )
import Constants
import List ( partition, intersperse )
import Maybes ( maybeToBool )
import Constants
import List ( partition, intersperse )
-import Outputable ( pprPanic, ppr )
+import Outputable ( pprPanic, ppr, pprTrace )
#if __GLASGOW_HASKELL__ >= 404
import GlaExts ( fromInt )
#if __GLASGOW_HASKELL__ >= 404
import GlaExts ( fromInt )
c.f. Figure 18 in Haskell 1.1 report.
-}
paren_prec_limit
c.f. Figure 18 in Haskell 1.1 report.
-}
paren_prec_limit
- | not is_infix = fromInt maxPrecedence
- | otherwise = getFixity get_fixity dc_nm
+ | not is_infix = defaultPrecedence
+ | otherwise = getPrecedence get_fixity dc_nm
read_paren_arg -- parens depend on precedence...
| nullary_con = false_Expr -- it's optional.
read_paren_arg -- parens depend on precedence...
| nullary_con = false_Expr -- it's optional.
c.f. Figure 16 and 17 in Haskell 1.1 report
-}
paren_prec_limit
c.f. Figure 16 and 17 in Haskell 1.1 report
-}
paren_prec_limit
- | not is_infix = fromInt maxPrecedence + 1
- | otherwise = getFixity get_fixity dc_nm + 1
+ | not is_infix = defaultPrecedence + 1
+ | otherwise = getPrecedence get_fixity dc_nm + 1
cf. Figures 16-18 in Haskell 1.1 report.
-}
(con_left_assoc, con_right_assoc) = isLRAssoc get_fixity nm
cf. Figures 16-18 in Haskell 1.1 report.
-}
(con_left_assoc, con_right_assoc) = isLRAssoc get_fixity nm
- paren_con_prec = getFixity get_fixity nm
- maxPrec = fromInt maxPrecedence
+ paren_con_prec = getPrecedence get_fixity nm
- | not is_infix = maxPrec + 1
+ | not is_infix = defaultPrecedence + 1
| con_left_assoc = paren_con_prec
| otherwise = paren_con_prec + 1
rp
| con_left_assoc = paren_con_prec
| otherwise = paren_con_prec + 1
rp
- | not is_infix = maxPrec + 1
+ | not is_infix = defaultPrecedence + 1
| con_right_assoc = paren_con_prec
| otherwise = paren_con_prec + 1
| con_right_assoc = paren_con_prec
| otherwise = paren_con_prec + 1
-getFixity :: (Name -> Maybe Fixity) -> Name -> Integer
-getFixity get_fixity nm
+defaultPrecedence :: Integer
+defaultPrecedence = fromInt maxPrecedence
+
+getPrecedence :: (Name -> Maybe Fixity) -> Name -> Integer
+getPrecedence get_fixity nm
= case get_fixity nm of
Just (Fixity x _) -> fromInt x
= case get_fixity nm of
Just (Fixity x _) -> fromInt x
- other -> pprPanic "TcGenDeriv.getFixity" (ppr nm)
+ other -> pprTrace "TcGenDeriv.getPrecedence" (ppr nm) defaultPrecedence
isLRAssoc :: (Name -> Maybe Fixity) -> Name -> (Bool, Bool)
isLRAssoc get_fixity nm =
isLRAssoc :: (Name -> Maybe Fixity) -> Name -> (Bool, Bool)
isLRAssoc get_fixity nm =
import TyCon ( TyCon, isSynTyCon )
import Type ( splitDFunTy, isTyVarTy,
splitTyConApp_maybe, splitDictTy,
import TyCon ( TyCon, isSynTyCon )
import Type ( splitDFunTy, isTyVarTy,
splitTyConApp_maybe, splitDictTy,
- splitAlgTyConApp_maybe, splitForAllTys,
tyVarsOfTypes, mkClassPred, mkTyVarTy,
getClassTys_maybe
)
tyVarsOfTypes, mkClassPred, mkTyVarTy,
getClassTys_maybe
)
maybe_tycon_app = splitTyConApp_maybe first_inst_tau
Just (tycon, arg_tys) = maybe_tycon_app
maybe_tycon_app = splitTyConApp_maybe first_inst_tau
Just (tycon, arg_tys) = maybe_tycon_app
- -- Stuff for an *algebraic* data type
- alg_tycon_app_maybe = splitAlgTyConApp_maybe first_inst_tau
- -- The "Alg" part looks through synonyms
- Just (alg_tycon, _, _) = alg_tycon_app_maybe
-
ccallable_type dflags ty = isFFIArgumentTy dflags False {- Not safe call -} ty
creturnable_type ty = isFFIResultTy ty
\end{code}
ccallable_type dflags ty = isFFIArgumentTy dflags False {- Not safe call -} ty
creturnable_type ty = isFFIResultTy ty
\end{code}
:: DynFlags
-> Module
-> PersistentCompilerState
:: DynFlags
-> Module
-> PersistentCompilerState
- -> HomeSymbolTable -> HomeIfaceTable
+ -> HomeSymbolTable
+ -> ModIface -- Iface for this module
-> [RenamedHsDecl]
-> IO (Maybe TcResults)
-> [RenamedHsDecl]
-> IO (Maybe TcResults)
-typecheckModule dflags this_mod pcs hst hit decls
+typecheckModule dflags this_mod pcs hst mod_iface decls
= do env <- initTcEnv hst (pcs_PTE pcs)
(maybe_result, (warns,errs)) <- initTc dflags env tc_module
= do env <- initTcEnv hst (pcs_PTE pcs)
(maybe_result, (warns,errs)) <- initTc dflags env tc_module
tc_module :: TcM (RecTcEnv, TcResults)
tc_module = fixTc (\ ~(unf_env ,_) -> tcModule pcs hst get_fixity this_mod decls unf_env)
tc_module :: TcM (RecTcEnv, TcResults)
tc_module = fixTc (\ ~(unf_env ,_) -> tcModule pcs hst get_fixity this_mod decls unf_env)
+ pit = pcs_PIT pcs
+ fixity_env = mi_fixities mod_iface
get_fixity :: Name -> Maybe Fixity
get_fixity :: Name -> Maybe Fixity
- get_fixity nm = lookupIface hit pit this_mod nm `thenMaybe` \ iface ->
- lookupNameEnv (mi_fixities iface) nm
+ get_fixity nm = lookupNameEnv fixity_env nm
\end{code}
The internal monster:
\end{code}
The internal monster:
\begin{code}
tyClDeclFTVs :: RenamedTyClDecl -> [Name]
\begin{code}
tyClDeclFTVs :: RenamedTyClDecl -> [Name]
+ -- Find the free non-tyvar vars
tyClDeclFTVs d = foldNameSet add [] (tyClDeclFVs d)
where
add n fvs | isTyVarName n = fvs
tyClDeclFTVs d = foldNameSet add [] (tyClDeclFVs d)
where
add n fvs | isTyVarName n = fvs