We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 252cf14 commit b0e088eCopy full SHA for b0e088e
grin/src/Transformations/ExtendedSyntax/Optimising/EvaluatedCaseElimination.hs
@@ -2,14 +2,15 @@
2
module Transformations.ExtendedSyntax.Optimising.EvaluatedCaseElimination where
3
4
import Data.Functor.Foldable as Foldable
5
-import Grin.Grin
+import Grin.ExtendedSyntax.Grin
6
7
evaluatedCaseElimination :: Exp -> Exp
8
evaluatedCaseElimination = ana builder where
9
builder :: Exp -> ExpF Exp
10
builder = \case
11
- ECase val alts | all (altBodyEQ $ SReturn val) alts -> SReturnF val
+ ECase scrut alts | all (altBodyEQ $ SReturn (Var scrut)) alts -> SReturnF (Var scrut)
12
exp -> project exp
13
14
altBodyEQ :: Exp -> Alt -> Bool
15
- altBodyEQ exp (Alt _cpat body) = exp == body
+ altBodyEQ exp (Alt _cpat _altName body) = exp == body
16
+
0 commit comments