From 0649eca400625120642cb5eaf5c482cf1c858ee1 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Wed, 11 Feb 2009 12:37:50 +0100 Subject: [PATCH] Learn flattenExpr about building tuples. --- Flatten.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Flatten.hs b/Flatten.hs index 9d05043..7dc261e 100644 --- a/Flatten.hs +++ b/Flatten.hs @@ -259,7 +259,14 @@ flattenExpr binds app@(App _ _) = do let ((Var f), args) = collectArgs app in flattenApplicationExpr binds (CoreUtils.exprType app) f args where - flattenBuildTupleExpr = error $ "Tuple construction not supported: " ++ (showSDoc $ ppr app) + flattenBuildTupleExpr binds args = do + -- Flatten each of our args + flat_args <- (State.mapM (flattenExpr binds) args) + -- Check and split each of the arguments + let (_, arg_ress) = unzip (zipWith checkArg args flat_args) + let res = Tuple arg_ress + return ([], res) + -- | Flatten a normal application expression flattenApplicationExpr binds ty f args = do -- Find the function to call -- 2.30.2