aboutsummaryrefslogtreecommitdiff
path: root/src/Simplify.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-07-23 21:09:59 +0200
committerTom Smeding <tom@tomsmeding.com>2025-07-23 21:09:59 +0200
commitf6b5850f949eb671f0c7038db6dff80ca23ed946 (patch)
tree9cbf14f3fe9512044b744549a4bad85a2a6a3cc0 /src/Simplify.hs
parent888bf4ed19afb2970a5f449fc285d3ef217baed8 (diff)
WIP pruneExpr in AST.Countfancy-count
Diffstat (limited to 'src/Simplify.hs')
-rw-r--r--src/Simplify.hs11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/Simplify.hs b/src/Simplify.hs
index 74b6601..28b6d60 100644
--- a/src/Simplify.hs
+++ b/src/Simplify.hs
@@ -200,6 +200,7 @@ simplify'Rec = \case
EMaybe ext (ESnd ext e1) (ESnd ext e2) e3
-- TODO: more array indexing
+ EIdx _ (EBuild _ _ _ e1) e2 -> acted $ simplify' $ elet e2 e1
EIdx _ (EReplicate1Inner _ _ e2) e3 -> acted $ simplify' $ EIdx ext e2 (EFst ext e3)
EIdx _ (EUnit _ e1) _ -> acted $ simplify' $ e1
@@ -336,16 +337,6 @@ simplify'Rec = \case
EPlus _ t a b -> [simprec| EPlus ext t *a *b |]
EError _ t s -> pure $ EError ext t s
-cheapExpr :: Expr x env t -> Bool
-cheapExpr = \case
- EVar{} -> True
- ENil{} -> True
- EConst{} -> True
- EFst _ e -> cheapExpr e
- ESnd _ e -> cheapExpr e
- EUnit _ e -> cheapExpr e
- _ -> False
-
-- | This can be made more precise by tracking (and not counting) adds on
-- locally eliminated accumulators.
hasAdds :: Expr x env t -> Bool