import CmdLineOpts ( DynFlag(..), DynFlags, dopt )
import HsSyn ( HsBinds(..), MonoBinds(..), HsDecl(..), HsExpr(..),
Stmt(..), InPat(..), HsMatchContext(..), HsDoContext(..), RuleDecl(..),
- isIfaceRuleDecl, nullBinds, andMonoBindList, mkSimpleMatch, placeHolderType
+ isIfaceRuleDecl, nullBinds, mkSimpleMatch, placeHolderType
)
import PrelNames ( mAIN_Name, mainName, ioTyConName, printName,
returnIOName, bindIOName, failIOName,
import MkIface ( pprModDetails )
import TcExpr ( tcMonoExpr )
import TcMonad
-import TcMType ( unifyTauTy, newTyVarTy, zonkTcType, tcInstType )
+import TcMType ( newTyVarTy, zonkTcType, tcInstType )
import TcType ( Type, liftedTypeKind, openTypeKind,
tyVarsOfType, tidyType, tcFunResultTy,
mkForAllTys, mkFunTys, mkTyConApp, tcSplitForAllTys
import TcForeign ( tcForeignImports, tcForeignExports )
import TcIfaceSig ( tcInterfaceSigs )
import TcInstDcls ( tcInstDecls1, tcInstDecls2 )
+import TcUnify ( unifyTauTy )
import TcSimplify ( tcSimplifyTop, tcSimplifyInfer )
import TcTyClsDecls ( tcTyAndClassDecls )
-import CoreUnfold ( unfoldingTemplate, hasUnfolding )
+import CoreUnfold ( unfoldingTemplate )
import TysWiredIn ( mkListTy, unitTy )
import ErrUtils ( printErrorsAndWarnings, errorsFound,
dumpIfSet_dyn, dumpIfSet_dyn_or, showPass )
PackageTypeEnv, ModIface(..),
ModDetails(..), DFunId,
TypeEnv, extendTypeEnvList, typeEnvTyCons, typeEnvElts,
- TyThing(..),
mkTypeEnv
)
\end{code}
tcTyAndClassDecls unf_env this_mod tycl_decls `thenTc` \ env ->
tcSetEnv env $
+ -- Interface type signatures
+ -- We tie a knot so that the Ids read out of interfaces are in scope
+ -- when we read their pragmas.
+ -- What we rely on is that pragmas are typechecked lazily; if
+ -- any type errors are found (ie there's an inconsistency)
+ -- we silently discard the pragma
+ traceTc (text "Tc2") `thenNF_Tc_`
+ tcInterfaceSigs unf_env this_mod tycl_decls `thenTc` \ sig_ids ->
+ tcExtendGlobalValEnv sig_ids $
+
-- Typecheck the instance decls, includes deriving
- traceTc (text "Tc2") `thenNF_Tc_`
+ -- Note that imported dictionary functions are already
+ -- in scope from the preceding tcInterfaceSigs
+ traceTc (text "Tc3") `thenNF_Tc_`
tcInstDecls1 (pcs_insts pcs) (pcs_PRS pcs)
hst unf_env get_fixity this_mod
decls `thenTc` \ (new_pcs_insts, inst_env, local_insts, deriv_binds) ->
tcSetInstEnv inst_env $
- -- Interface type signatures
- -- We tie a knot so that the Ids read out of interfaces are in scope
- -- when we read their pragmas.
- -- What we rely on is that pragmas are typechecked lazily; if
- -- any type errors are found (ie there's an inconsistency)
- -- we silently discard the pragma
- traceTc (text "Tc3") `thenNF_Tc_`
- tcInterfaceSigs unf_env this_mod tycl_decls `thenTc` \ sig_ids ->
- tcExtendGlobalValEnv sig_ids $
-
-
tcIfaceRules unf_env (pcs_rules pcs) this_mod iface_rules `thenNF_Tc` \ (new_pcs_rules, local_rules) ->
-- When relinking this module from its interface-file decls
-- we'll have IfaceRules that are in fact local to this module