diff options
Diffstat (limited to 'src/Simplify.hs')
-rw-r--r-- | src/Simplify.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Simplify.hs b/src/Simplify.hs index acc2392..16a3e1d 100644 --- a/src/Simplify.hs +++ b/src/Simplify.hs @@ -48,6 +48,12 @@ simplify = \case -- eta rule for return+bind EMBind (EMReturn _ a) b -> simplify (ELet ext a b) + -- associativity of bind + EMBind (EMBind a b) c -> simplify (EMBind a (EMBind b (weakenExpr (WCopy WSink) c))) + + -- bind-let commute + EMBind (ELet _ a b) c -> simplify (ELet ext a (EMBind b (weakenExpr (WCopy WSink) c))) + EVar _ t i -> EVar ext t i ELet _ a b -> ELet ext (simplify a) (simplify b) EPair _ a b -> EPair ext (simplify a) (simplify b) |