summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNanoTech2016-12-11 23:22:58 -0600
committerNanoTech2017-03-10 23:48:29 -0600
commitefd52ef33c15316dbd39390d55022708488a53b8 (patch)
tree5ce894b773839a419953d77513c516e9f520c9af /src
parenteca97e7b04ce5c02ffeef3fa0f1c4da5c4d25a26 (diff)
Implement fold/build fusion normalize cases
Diffstat (limited to 'src')
-rw-r--r--src/core.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core.rs b/src/core.rs
index f66595b..570e013 100644
--- a/src/core.rs
+++ b/src/core.rs
@@ -847,15 +847,15 @@ pub fn normalize<'i, S, T, A>(e: &Expr<'i, S, A>) -> Expr<'i, T, A>
normalize(&b3)
}
f2 => match (f2, normalize::<S, T, A>(a)) {
- /*
- -- fold/build fusion for `List`
- App (App ListBuild _) (App (App ListFold _) e') -> normalize e'
- App (App ListFold _) (App (App ListBuild _) e') -> normalize e'
+ // fold/build fusion for `List`
+ (App(box BuiltinValue(ListBuild), _), App(box App(box BuiltinValue(ListFold), _), box e2)) => normalize(&e2),
+ (App(box BuiltinValue(ListFold), _), App(box App(box BuiltinValue(ListBuild), _), box e2)) => normalize(&e2),
- -- fold/build fusion for `Natural`
- App NaturalBuild (App NaturalFold e') -> normalize e'
- App NaturalFold (App NaturalBuild e') -> normalize e'
+ // fold/build fusion for `Natural`
+ (BuiltinValue(NaturalBuild), App(box BuiltinValue(NaturalFold), box e2)) => normalize(&e2),
+ (BuiltinValue(NaturalFold), App(box BuiltinValue(NaturalBuild), box e2)) => normalize(&e2),
+ /*
App (App (App (App NaturalFold (NaturalLit n0)) _) succ') zero ->
normalize (go n0)
where