Do not apply eta expansion to application arguments.
[matthijs/master-project/cλash.git] / Normalize.hs
index 9aedb4b856a17f8292241262df1f9622527efb9a..cceefc0cf7baf76c4135da6ef12cc7f9c5922988 100644 (file)
@@ -43,13 +43,14 @@ import Pretty
 -- η abstraction
 --------------------------------
 eta, etatop :: Transform
+eta expr | is_fun expr && not (is_lam expr) = do
 eta expr | is_fun expr && not (is_lam expr) = do
   let arg_ty = (fst . Type.splitFunTy . CoreUtils.exprType) expr
   id <- mkInternalVar "param" arg_ty
   change (Lam id (App expr (Var id)))
 -- Leave all other expressions unchanged
 eta e = return e
-etatop = notapplied ("eta", eta)
+etatop = notappargs ("eta", eta)
 
 --------------------------------
 -- β-reduction