X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=c%CE%BBash%2FCLasH%2FNormalize.hs;h=6fd6a2e03cb0df3c5e553a57306f294b48e5d1cb;hb=6e0808a8e328f0a5fc0c62f0328c978507fd5627;hp=4ef112b605e762c16186f12951123a37574e060d;hpb=5eb86d4e07de5c2a31e0862314d100f72bfaa46e;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git "a/c\316\273ash/CLasH/Normalize.hs" "b/c\316\273ash/CLasH/Normalize.hs" index 4ef112b..6fd6a2e 100644 --- "a/c\316\273ash/CLasH/Normalize.hs" +++ "b/c\316\273ash/CLasH/Normalize.hs" @@ -64,8 +64,10 @@ etatop = notappargs ("eta", eta) -- β-reduction -------------------------------- beta, betatop :: Transform --- Substitute arg for x in expr -beta (App (Lam x expr) arg) = setChanged >> substitute x arg expr +-- Substitute arg for x in expr. For value lambda's, also clone before +-- substitution. +beta (App (Lam x expr) arg) | CoreSyn.isTyVar x = setChanged >> substitute x arg expr + | otherwise = setChanged >> substitute_clone x arg expr -- Propagate the application into the let beta (App (Let binds expr) arg) = change $ Let binds (App expr arg) -- Propagate the application into each of the alternatives