From: Matthijs Kooijman Date: Thu, 19 Feb 2009 14:48:58 +0000 (+0100) Subject: Support construction of empty tuples. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=0bc61dd521c7211ba4db643036f8517bb8bb48f4;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Support construction of empty tuples. --- diff --git a/Flatten.hs b/Flatten.hs index 11738c7..1eaa0ff 100644 --- a/Flatten.hs +++ b/Flatten.hs @@ -157,13 +157,18 @@ flattenExpr binds var@(Var id) = Left sig_use -> return ([], sig_use) Right _ -> error "Higher order functions not supported." IdInfo.DataConWorkId datacon -> do - lit <- dataConToLiteral datacon - let ty = CoreUtils.exprType var - sig_id <- genSignalId SigInternal ty - -- Add a name hint to the signal - addNameHint (Name.getOccString id) sig_id - addDef (UncondDef (Right $ Literal lit) sig_id) - return ([], Single sig_id) + if DataCon.isTupleCon datacon && (null $ DataCon.dataConAllTyVars datacon) + then do + -- Empty tuple construction + return ([], Tuple []) + else do + lit <- dataConToLiteral datacon + let ty = CoreUtils.exprType var + sig_id <- genSignalId SigInternal ty + -- Add a name hint to the signal + addNameHint (Name.getOccString id) sig_id + addDef (UncondDef (Right $ Literal lit) sig_id) + return ([], Single sig_id) otherwise -> error $ "Ids other than local vars and dataconstructors not supported: " ++ (showSDoc $ ppr id)