summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-03-04 23:22:08 +0100
committerTom Smeding <tom@tomsmeding.com>2025-03-04 23:22:08 +0100
commit89b78d480a88559a8a9064eeafa60af345db4f2d (patch)
tree7bae8c366c35092789928bbe2a2a25a9d2a0c7dd
parent8ac606b8f0c482679e9f017e6b2f0f33d58f9573 (diff)
Fix big oops bug in simplify
The dangers of writing a simplifier for an effectful language. I thought this was easy, but apparently it's all too simple to trip up...
-rw-r--r--src/Simplify.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Simplify.hs b/src/Simplify.hs
index 0132f85..2177789 100644
--- a/src/Simplify.hs
+++ b/src/Simplify.hs
@@ -105,12 +105,12 @@ simplify' = \case
EIdx1 _ (ELet _ rhs body) e -> acted $ simplify' (ELet ext rhs (EIdx1 ext body (weakenExpr WSink e)))
-- projection down-commuting
- EFst _ (ECase _ e1 (EPair _ e2 _) (EPair _ e3 _)) ->
+ EFst _ (ECase _ e1 e2@EPair{} e3@EPair{}) ->
acted $ simplify' $
- ECase ext e1 e2 e3
- ESnd _ (ECase _ e1 (EPair _ _ e2) (EPair _ _ e3)) ->
+ ECase ext e1 (EFst ext e2) (EFst ext e3)
+ ESnd _ (ECase _ e1 e2@EPair{} e3@EPair{}) ->
acted $ simplify' $
- ECase ext e1 e2 e3
+ ECase ext e1 (ESnd ext e2) (ESnd ext e3)
-- TODO: array indexing (index of build, index of fold)