+ where
+ dflags = hsc_dflags hsc_env
+ print_unqual = unQualInScope rdr_env
+
+ -- Desugarer warnings are SDocs; here we
+ -- add the info about whether or not to print unqualified
+ mk_warn :: (SrcLoc,SDoc) -> (SrcLoc, Pretty.Doc)
+ mk_warn (loc, sdoc) = addShortWarnLocLine loc print_unqual sdoc
+
+ -- The lookup function passed to initDs is used for well-known Ids,
+ -- such as fold, build, cons etc, so the chances are
+ -- it'll be found in the package symbol table. That's
+ -- why we don't merge all these tables
+ eps = pcs_EPS pcs
+ pte = eps_PTE eps
+ hpt = hsc_HPT hsc_env
+ lookup n = case lookupType hpt pte n of {
+ Just v -> v ;
+ other ->
+ case lookupNameEnv type_env n of
+ Just v -> v ;
+ other -> pprPanic "Desugar: lookup:" (ppr n)
+ }
+
+deSugarExpr :: HscEnv
+ -> PersistentCompilerState
+ -> Module -> PrintUnqualified
+ -> TypecheckedHsExpr
+ -> IO CoreExpr
+deSugarExpr hsc_env pcs mod_name unqual tc_expr
+ = do { showPass dflags "Desugar"
+ ; us <- mkSplitUniqSupply 'd'