X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=clash%2FCLasH%2FNormalize.hs;h=a70829ade05370f51d66c9dbe0575e8e124ef97c;hb=c86f74b8af5fb3ca467c7a22fa2d14498b46fb1a;hp=ea171ca05f7b783a6731845e037a4c7216ee9291;hpb=d3b0fc8a0ff805488e67881b71f2cf29db0f10fb;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/clash/CLasH/Normalize.hs b/clash/CLasH/Normalize.hs index ea171ca..a70829a 100644 --- a/clash/CLasH/Normalize.hs +++ b/clash/CLasH/Normalize.hs @@ -380,7 +380,7 @@ funextract c expr@(App _ _) | is_var fexpr = do -- We could use is_applicable here instead of is_fun, but I think -- arguments to functions could only have forall typing when existential -- typing is enabled. Not sure, though. - doarg arg | not (is_simple arg) && is_fun arg = do + doarg arg | not (is_simple arg) && is_fun arg && not (has_free_tyvars arg) = do -- Create a new top level binding that binds the argument. Its body will -- be extended with lambda expressions, to take any free variables used -- by the argument expression. @@ -753,7 +753,7 @@ inlinenonrepresult :: Transform -- that is fully applied (i.e., dos not have a function type) but is not -- representable. We apply in any context, since non-representable -- expressions are generally left alone and can occur anywhere. -inlinenonrepresult context expr | not (is_fun expr) = +inlinenonrepresult context expr | not (is_applicable expr) && not (has_free_tyvars expr) = case collectArgs expr of (Var f, args) | not (Id.isDictId f) -> do repr <- isRepr expr @@ -952,7 +952,7 @@ letmerge c expr = return expr -- What transforms to run? transforms = [ ("inlinedict", inlinedict) , ("inlinetoplevel", inlinetoplevel) - -- , ("inlinenonrepresult", inlinenonrepresult) + , ("inlinenonrepresult", inlinenonrepresult) , ("knowncase", knowncase) , ("classopresolution", classopresolution) , ("argprop", argprop)