X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=Flatten.hs;h=1eaa0fffa26cfe1b3d4ae7c41e6b80a9de7244c7;hb=0dd32af30fee665611e77cfb7bf8fc82f70c970b;hp=11738c70f5803509056662013ee711b6fec93c54;hpb=c0fa1614f8bb0126868658fad79b01df447e113a;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)