X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=Flatten.hs;h=1eaa0fffa26cfe1b3d4ae7c41e6b80a9de7244c7;hb=0bc61dd521c7211ba4db643036f8517bb8bb48f4;hp=11738c70f5803509056662013ee711b6fec93c54;hpb=684c5b250d98bc3e96193e073300234ea617b07e;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git 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)