import CmdLineOpts ( DynFlag(..), DynFlags, dopt )
import HsSyn ( HsBinds(..), MonoBinds(..), HsDecl(..), HsExpr(..),
- Stmt(..), InPat(..), HsMatchContext(..), RuleDecl(..),
+ Stmt(..), InPat(..), HsMatchContext(..), HsDoContext(..), RuleDecl(..),
isIfaceRuleDecl, nullBinds, andMonoBindList, mkSimpleMatch
)
import PrelNames ( SyntaxMap, mAIN_Name, mainName, ioTyConName, printName,
import MkIface ( pprModDetails )
import TcExpr ( tcMonoExpr )
import TcMonad
-import TcType ( newTyVarTy, zonkTcType, tcInstType )
+import TcMType ( unifyTauTy, newTyVarTy, zonkTcType, tcInstType )
+import TcType ( Type, liftedTypeKind, openTypeKind,
+ tyVarsOfType, tidyType, tcFunResultTy,
+ mkForAllTys, mkFunTys, mkTyConApp, tcSplitForAllTys
+ )
import TcMatches ( tcStmtsAndThen )
-import TcUnify ( unifyTauTy )
import Inst ( emptyLIE, plusLIE )
import TcBinds ( tcTopBinds )
import TcClassDcl ( tcClassDecls2 )
import TcInstDcls ( tcInstDecls1, tcInstDecls2 )
import TcSimplify ( tcSimplifyTop, tcSimplifyInfer )
import TcTyClsDecls ( tcTyAndClassDecls )
-
import CoreUnfold ( unfoldingTemplate, hasUnfolding )
import TysWiredIn ( mkListTy, unitTy )
-import Type
import ErrUtils ( printErrorsAndWarnings, errorsFound,
dumpIfSet_dyn, dumpIfSet_dyn_or, showPass )
import Id ( Id, idType, idUnfolding )
TyThing(..), implicitTyThingIds,
mkTypeEnv
)
-import VarSet
\end{code}
in
traceTc (text "tcs 2") `thenNF_Tc_`
- tcStmtsAndThen combine DoExpr io_ty stmts (
+ tcStmtsAndThen combine (DoCtxt DoExpr) io_ty stmts (
-- Look up the names right in the middle,
-- where they will all be in scope
mapNF_Tc tcLookupId names `thenNF_Tc` \ ids ->
- returnTc ((ids, [ExprStmt (mk_return ids) noSrcLoc]), emptyLIE)
+ returnTc ((ids, [ResultStmt (mk_return ids) noSrcLoc]), emptyLIE)
) `thenTc` \ ((ids, tc_stmts), lie) ->
-- Simplify the context right here, so that we fail
newTyVarTy openTypeKind `thenTc` \ ty ->
tcMonoExpr expr ty `thenTc` \ (e', lie) ->
- tcSimplifyInfer smpl_doc (varSetElems (tyVarsOfType ty)) lie
- `thenTc` \ (qtvs, lie_free, dict_binds, dict_ids) ->
+ tcSimplifyInfer smpl_doc (tyVarsOfType ty) lie
+ `thenTc` \ (qtvs, lie_free, dict_binds, dict_ids) ->
tcSimplifyTop lie_free `thenTc` \ const_binds ->
let all_expr = mkHsLet const_binds $
tcModule pcs hst get_fixity this_mod decls
= fixTc (\ ~(unf_env, _, _) ->
- -- Loop back the final environment, including the fully zonkec
+ -- Loop back the final environment, including the fully zonked
-- versions of bindings from this module. In the presence of mutual
-- recursion, interface type signatures may mention variables defined
-- in this module, which is why the knot is so big
lie_rules
in
tcSimplifyTop lie_alldecls `thenTc` \ const_inst_binds ->
+ traceTc (text "endsimpltop") `thenTc_`
-- Backsubstitution. This must be done last.
-- Even tcSimplifyTop may do some unification.
| otherwise = ppr tycon <> colon <+> ptext SLIT("Not derivable")
ppr_ep (EP from to)
- = vcat [ ptext SLIT("Rep type:") <+> ppr (funResultTy from_tau),
+ = vcat [ ptext SLIT("Rep type:") <+> ppr (tcFunResultTy from_tau),
ptext SLIT("From:") <+> ppr (unfoldingTemplate (idUnfolding from)),
ptext SLIT("To:") <+> ppr (unfoldingTemplate (idUnfolding to))
]
where
- (_,from_tau) = splitForAllTys (idType from)
-
+ (_,from_tau) = tcSplitForAllTys (idType from)
\end{code}