-
-tcPolyBinds top_lvl rec_group rec_tc sig_fn prag_fn scc thing_inside
- = -- NB: polymorphic recursion means that a function
- -- may use an instance of itself, we must look at the LIE arising
- -- from the function's own right hand side. Hence the getLIE
- -- encloses the tc_poly_binds.
- do { traceTc (text "tcPolyBinds" <+> ppr scc)
- ; ((binds1, poly_ids, thing), lie) <- getLIE $
- do { (binds1, poly_ids) <- tc_poly_binds top_lvl rec_group rec_tc
- sig_fn prag_fn scc
- ; thing <- tcExtendIdEnv poly_ids thing_inside
- ; return (binds1, poly_ids, thing) }
-
- ; if isTopLevel top_lvl
- then -- For the top level don't bother will all this
- -- bindInstsOfLocalFuns stuff. All the top level
- -- things are rec'd together anyway, so it's fine to
- -- leave them to the tcSimplifyTop,
- -- and quite a bit faster too
- do { extendLIEs lie; return (binds1, thing) }
-
- else do -- Nested case
- { lie_binds <- bindInstsOfLocalFuns lie poly_ids
- ; return (binds1 ++ [lie_binds], thing) }}
-
-------------------------
-tc_poly_binds :: TopLevelFlag -- See comments on tcPolyBinds
- -> RecFlag -> RecFlag
- -> TcSigFun -> TcPragFun
- -> LHsBinds Name
- -> TcM ([LHsBinds TcId], [TcId])
--- Typechecks the bindings themselves