Commit 9ceeb6e5 authored by simonpj's avatar simonpj
Browse files

[project @ 2003-01-24 11:26:39 by simonpj]

Perform 'tidying' on the implicit bindings before emitting
	External Core.  We were getting silly bindings like
		\ tpl -> case tpl of tpl -> (tpl,tpl) -> tpl

	Maybe we should add these implicit bindings in CoreTidy,
	rather than in both MkExternalCore and CorePrep?
parent e989066d
......@@ -60,9 +60,6 @@ tidyBind env (Rec prs)
------------ Expressions --------------
tidyCoreExpr :: CoreExpr -> IO CoreExpr
tidyCoreExpr expr = return (tidyExpr emptyTidyEnv expr)
tidyExpr env (Var v) = Var (tidyVarOcc env v)
tidyExpr env (Type ty) = Type (tidyType env ty)
tidyExpr env (Lit lit) = Lit lit
......
......@@ -23,6 +23,8 @@ import CoreSyn
import Var
import IdInfo
import Id( idUnfolding )
import CoreTidy( tidyExpr )
import VarEnv( emptyTidyEnv )
import Literal
import Name
import CostCentre
......@@ -68,7 +70,13 @@ implicit_ids (AClass cl) = classSelIds cl
implicit_ids other = []
get_defn :: Id -> CoreBind
get_defn id = NonRec id (unfoldingTemplate (idUnfolding id))
get_defn id = NonRec id rhs
where
rhs = tidyExpr emptyTidyEnv body
body = unfoldingTemplate (idUnfolding id)
-- Don't forget to tidy the body ! Otherwise you get silly things like
-- \ tpl -> case tpl of tpl -> (tpl,tpl) -> tpl
-- Maybe we should inject these bindings during CoreTidy?
collect_tdefs :: TyCon -> [C.Tdef] -> [C.Tdef]
collect_tdefs tcon tdefs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment