From: Matthijs Kooijman Date: Sun, 21 Jun 2009 15:47:36 +0000 (+0200) Subject: Make beta reduction of Case expressions work for type arguments. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;ds=sidebyside;h=2c984b0eb64800eed57a50b4b5f8a4c78ab15097;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Make beta reduction of Case expressions work for type arguments. Previously, splitFunTy was used, which assumes a function type, while a type argument is applied to a forall type instead of a function type. Using applyTypeToArg handles all this for us. --- diff --git a/Normalize.hs b/Normalize.hs index cbe2090..a011991 100644 --- a/Normalize.hs +++ b/Normalize.hs @@ -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