From: Matthijs Kooijman Date: Thu, 6 Aug 2009 13:47:19 +0000 (+0200) Subject: Let mkTupleShow support empty tuples. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=985ebbadb94858d95211ae159cd6fe344e1c5d8f;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Let mkTupleShow support empty tuples. --- diff --git "a/c\316\273ash/CLasH/VHDL/VHDLTools.hs" "b/c\316\273ash/CLasH/VHDL/VHDLTools.hs" index fbe33a7..b2416dc 100644 --- "a/c\316\273ash/CLasH/VHDL/VHDLTools.hs" +++ "b/c\316\273ash/CLasH/VHDL/VHDLTools.hs" @@ -575,13 +575,16 @@ mkTupleShow elemTMs tupleTM = AST.SubProgBody showSpec [] [showExpr] showExpr = AST.ReturnSm (Just $ AST.PrimLit "'('" AST.:&: showMiddle AST.:&: AST.PrimLit "')'") where - showMiddle = foldr1 (\e1 e2 -> e1 AST.:&: AST.PrimLit "','" AST.:&: e2) $ - map ((genExprFCall showId). - AST.PrimName . - AST.NSelected . - (AST.NSimple tupPar AST.:.:). - tupVHDLSuffix) - (take tupSize recordlabels) + showMiddle = if null elemTMs then + AST.PrimLit "''" + else + foldr1 (\e1 e2 -> e1 AST.:&: AST.PrimLit "','" AST.:&: e2) $ + map ((genExprFCall showId). + AST.PrimName . + AST.NSelected . + (AST.NSimple tupPar AST.:.:). + tupVHDLSuffix) + (take tupSize recordlabels) recordlabels = map (\c -> mkVHDLBasicId [c]) ['A'..'Z'] tupSize = length elemTMs