From: Matthijs Kooijman Date: Wed, 11 Feb 2009 11:37:50 +0000 (+0100) Subject: Learn flattenExpr about building tuples. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=0649eca400625120642cb5eaf5c482cf1c858ee1;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Learn flattenExpr about building tuples. --- 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