X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=Normalize.hs;h=93369213e5260f4a3661e1f67769713d00ec4c76;hb=8153abb4f08f21e097eca9bd38fa6155675be40b;hp=e0591a87e222c5dfff98d2df755de9bf26d091a6;hpb=ce7380ad772e2a81c0329c6ee495e18fa0a62280;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/Normalize.hs b/Normalize.hs index e0591a8..9336921 100644 --- a/Normalize.hs +++ b/Normalize.hs @@ -213,6 +213,7 @@ casewild expr@(Case scrut b ty alts) = do -- and binds that to b. mkextracts :: CoreBndr -> Int -> TransformMonad (Maybe (CoreBndr, CoreExpr)) mkextracts b i = + -- TODO: Use free variables instead of is_wild. is_wild is a hack. if is_wild b || Type.isFunTy (Id.idType b) -- Don't create extra bindings for binders that are already wild, or -- for binders that bind function types (to prevent loops with @@ -284,13 +285,12 @@ caseremove expr = return expr caseremovetop = everywhere ("caseremove", caseremove) -------------------------------- --- Application simplification +-- Argument extraction -------------------------------- --- Make sure that all arguments in an application are simple variables. +-- Make sure that all arguments of a representable type are simple variables. appsimpl, appsimpltop :: Transform --- Don't simplify arguments that are already simple. Do simplify datacons, --- however, since we can't portmap literals. -appsimpl expr@(App f (Var v)) | not $ Id.isDataConWorkId v = return expr +-- Don't simplify arguments that are already simple. +appsimpl expr@(App f (Var v)) = return expr -- Simplify all non-applicable (to prevent loops with inlinefun) arguments, -- except for type arguments (since a let can't bind type vars, only a lambda -- can). Do this by introducing a new Let that binds the argument and passing