aboutsummaryrefslogtreecommitdiff
path: root/src/CHAD
diff options
context:
space:
mode:
Diffstat (limited to 'src/CHAD')
-rw-r--r--src/CHAD/AST/UnMonoid.hs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/CHAD/AST/UnMonoid.hs b/src/CHAD/AST/UnMonoid.hs
index 27c5f0a..d3cad25 100644
--- a/src/CHAD/AST/UnMonoid.hs
+++ b/src/CHAD/AST/UnMonoid.hs
@@ -104,13 +104,10 @@ plus :: SMTy t -> Ex env t -> Ex env t -> Ex env t
-- don't destroy the effects!
plus SMTNil a b = ELet ext a $ ELet ext (weakenExpr WSink b) $ ENil ext
plus (SMTPair t1 t2) a b =
- let t = STPair (fromSMTy t1) (fromSMTy t2)
- in ELet ext a $
- ELet ext (weakenExpr WSink b) $
- EPair ext (plus t1 (EFst ext (EVar ext t (IS IZ)))
- (EFst ext (EVar ext t IZ)))
- (plus t2 (ESnd ext (EVar ext t (IS IZ)))
- (ESnd ext (EVar ext t IZ)))
+ eunPair a $ \w1 a1 a2 ->
+ eunPair (weakenExpr w1 b) $ \w2 b1 b2 ->
+ EPair ext (plus t1 (weakenExpr w2 a1) b1)
+ (plus t2 (weakenExpr w2 a2) b2)
plus (SMTLEither t1 t2) a b =
let t = STLEither (fromSMTy t1) (fromSMTy t2)
in ELet ext a $