summaryrefslogtreecommitdiff
path: root/SC
diff options
context:
space:
mode:
Diffstat (limited to 'SC')
-rw-r--r--SC/Exp.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/SC/Exp.hs b/SC/Exp.hs
index 5ddd4bf..5c0bc72 100644
--- a/SC/Exp.hs
+++ b/SC/Exp.hs
@@ -91,10 +91,14 @@ compileExp' aenv env = \case
A.Pair a b -> do
(usedA1, res1) <- compileExp' aenv env a
(usedA2, res2) <- compileExp' aenv env b
- return (usedA1 ++ usedA2, Left (\case
- ITupPair n1 n2 -> toStoring res1 n1 ++ toStoring res2 n2
- ITupIgnore -> []
- ITupSingle _ -> error "wat"))
+ return (usedA1 ++ usedA2
+ ,case (res1, res2) of
+ (Right (sts1, exp1), Right (sts2, exp2)) ->
+ Right (sts1 ++ sts2, ITupPair exp1 exp2)
+ _ -> Left (\case
+ ITupPair n1 n2 -> toStoring res1 n1 ++ toStoring res2 n2
+ ITupIgnore -> []
+ ITupSingle _ -> error "wat"))
A.Const ty x
| Just str <- showExpConst ty x