From 89b78d480a88559a8a9064eeafa60af345db4f2d Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 4 Mar 2025 23:22:08 +0100 Subject: 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... --- src/Simplify.hs | 8 ++++---- 1 file 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) -- cgit v1.2.3-70-g09d2