X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Ftypecheck%2FTcModule.lhs;h=256e5bbad0e6917ed0c73d17eda493a3363e0113;hb=490cba33825083f8e785aeb35b5ac1667fc3954b;hp=ea69f290629d52a96df0688ac5b46e621008f8c7;hpb=9e9d8b056fb2342e5c0f9f67b94d0667814cb6b6;p=ghc-hetmet.git diff --git a/ghc/compiler/typecheck/TcModule.lhs b/ghc/compiler/typecheck/TcModule.lhs index ea69f29..256e5bb 100644 --- a/ghc/compiler/typecheck/TcModule.lhs +++ b/ghc/compiler/typecheck/TcModule.lhs @@ -65,9 +65,6 @@ Outside-world interface: -- Convenient type synonyms first: data TcResults = TcResults { - tc_pcs :: PersistentCompilerState, -- Augmented with imported information, - -- (but not stuff from this module) - -- All these fields have info *just for this module* tc_env :: TypeEnv, -- The top level TypeEnv tc_insts :: [DFunId], -- Instances @@ -79,20 +76,23 @@ data TcResults --------------- typecheckModule :: DynFlags - -> Module -> PersistentCompilerState -> HomeSymbolTable -> ModIface -- Iface for this module -> PrintUnqualified -- For error printing -> [RenamedHsDecl] - -> IO (Maybe TcResults) + -> IO (Maybe (PersistentCompilerState, TcResults)) + -- The new PCS is Augmented with imported information, + -- (but not stuff from this module) + -typecheckModule dflags this_mod pcs hst mod_iface unqual decls +typecheckModule dflags pcs hst mod_iface unqual decls = do { maybe_tc_result <- typecheck dflags pcs hst unqual $ - tcModule pcs hst get_fixity this_mod decls + tcModule pcs hst get_fixity this_mod decls ; printTcDump dflags maybe_tc_result ; return maybe_tc_result } where + this_mod = mi_module mod_iface fixity_env = mi_fixities mod_iface get_fixity :: Name -> Maybe Fixity @@ -121,8 +121,8 @@ typecheck :: DynFlags -> TcM r -> IO (Maybe r) -typecheck dflags pcs hst unqual thing_inside - = do { showPass dflags "Typechecker"; +typecheck dflags pcs hst unqual thing_inside + = do { showPass dflags "Typechecker"; ; env <- initTcEnv hst (pcs_PTE pcs) ; (maybe_tc_result, (warns,errs)) <- initTc dflags env thing_inside @@ -143,7 +143,7 @@ tcModule :: PersistentCompilerState -> (Name -> Maybe Fixity) -> Module -> [RenamedHsDecl] - -> TcM TcResults + -> TcM (PersistentCompilerState, TcResults) tcModule pcs hst get_fixity this_mod decls = -- Type-check the type and class decls @@ -283,8 +283,8 @@ tcModule pcs hst get_fixity this_mod decls } in -- traceTc (text "Tc10") `thenNF_Tc_` - returnTc (TcResults { tc_pcs = final_pcs, - tc_env = local_type_env, + returnTc (final_pcs, + TcResults { tc_env = local_type_env, tc_binds = all_binds', tc_insts = map iDFunId local_inst_info, tc_fords = foi_decls ++ foe_decls', @@ -305,7 +305,7 @@ get_binds decls = foldr ThenBinds EmptyBinds [binds | ValD binds <- decls] \begin{code} printTcDump dflags Nothing = return () -printTcDump dflags (Just results) +printTcDump dflags (Just (_, results)) = do dumpIfSet_dyn dflags Opt_D_dump_types "Type signatures" (dump_sigs results) dumpIfSet_dyn dflags Opt_D_dump_tc