Make beta reduction of Case expressions work for type arguments.
[matthijs/master-project/cλash.git] / Normalize.hs
index cbe2090e22def5d29d3b24bb878f37c68b81b3ea..a01199119929f1b00fbab01ada4bdf519df9fa10 100644 (file)
@@ -62,7 +62,7 @@ beta (App (Let binds expr) arg) = change $ Let binds (App expr arg)
 beta (App (Case scrut b ty alts) arg) = change $ Case scrut b ty' alts'
   where 
     alts' = map (\(con, bndrs, expr) -> (con, bndrs, (App expr arg))) alts
-    (_, ty') = Type.splitFunTy ty
+    ty' = CoreUtils.applyTypeToArg ty arg
 -- Leave all other expressions unchanged
 beta expr = return expr
 -- Perform this transform everywhere