summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadrieril2019-03-15 23:45:50 +0100
committerNadrieril2019-03-15 23:45:50 +0100
commit4f2c27bc1ca8c2147fa8e9292c6cec04ab8d0984 (patch)
treece4c93177f70c492c9a842c3e26d4f6390319d60
parent22aa5de3fb5836daf066add3e128173bbd396003 (diff)
Get rid of box patterns
Closes #27
-rw-r--r--dhall/src/lib.rs1
-rw-r--r--dhall/src/normalize.rs26
-rw-r--r--dhall_core/src/lib.rs1
3 files changed, 13 insertions, 15 deletions
diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs
index f976c65..d8ca955 100644
--- a/dhall/src/lib.rs
+++ b/dhall/src/lib.rs
@@ -1,4 +1,3 @@
-#![feature(box_patterns)]
#![feature(trace_macros)]
#![feature(proc_macro_hygiene)]
#![feature(slice_patterns)]
diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs
index 9f246e4..ca261e1 100644
--- a/dhall/src/normalize.rs
+++ b/dhall/src/normalize.rs
@@ -68,41 +68,41 @@ where
let xs = ys.iter().rev().cloned().collect();
ListLit(t.clone(), xs)
}
- (ListBuild, [a0, k]) => {
+ (ListBuild, [a0, g]) => {
// fold/build fusion
- let k = match k {
- App(box Builtin(ListFold), args) => {
- match args.as_slice() {
- [_, x, rest..] => {
+ let g = match g {
+ App(f, args) => {
+ match (&**f, args.as_slice()) {
+ (Builtin(ListFold), [_, x, rest..]) => {
return normalize_whnf(&App(
bx(x.clone()),
rest.to_vec(),
))
}
- args => app(Builtin(ListFold), args.to_vec()),
+ (f, args) => app(f.clone(), args.to_vec()),
}
}
- k => k.clone(),
+ g => g.clone(),
};
- let k = bx(k);
+ let g = bx(g);
let a0 = bx(a0.clone());
let a1 = bx(shift(1, &V("a".into(), 0), &a0));
normalize_whnf(
- &dhall_expr!(k (List a0) (λ(a : a0) -> λ(as : List a1) -> [ a ] # as) ([] : List a0)),
+ &dhall_expr!(g (List a0) (λ(a : a0) -> λ(as : List a1) -> [ a ] # as) ([] : List a0)),
)
}
(OptionalBuild, [a0, g]) => {
// fold/build fusion
let g = match g {
- App(box Builtin(OptionalFold), args) => {
- match args.as_slice() {
- [_, x, rest..] => {
+ App(f, args) => {
+ match (&**f, args.as_slice()) {
+ (Builtin(OptionalFold), [_, x, rest..]) => {
return normalize_whnf(&App(
bx(x.clone()),
rest.to_vec(),
))
}
- args => app(Builtin(OptionalFold), args.to_vec()),
+ (f, args) => app(f.clone(), args.to_vec()),
}
}
g => g.clone(),
diff --git a/dhall_core/src/lib.rs b/dhall_core/src/lib.rs
index 86b0363..c728a75 100644
--- a/dhall_core/src/lib.rs
+++ b/dhall_core/src/lib.rs
@@ -1,4 +1,3 @@
-#![feature(box_patterns)]
#![feature(trace_macros)]
#![allow(
clippy::many_single_char_names,