diff options
Diffstat (limited to '')
-rw-r--r-- | dhall/src/normalize.rs | 18 | ||||
-rw-r--r-- | dhall/src/traits/static_type.rs | 28 |
2 files changed, 23 insertions, 23 deletions
diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs index a54e48e..1561f01 100644 --- a/dhall/src/normalize.rs +++ b/dhall/src/normalize.rs @@ -1,7 +1,7 @@ #![allow(non_snake_case)] use crate::expr::*; use dhall_core::*; -use dhall_generator::dhall_expr; +use dhall_generator as dhall; use std::fmt; impl<'a> Typed<'a> { @@ -68,7 +68,7 @@ where (rc(NEListLit(ys)), rest) } (ListIndexed, [_, EmptyListLit(t), rest..]) => ( - dhall_expr!([] : List ({ index : Natural, value : t })), + dhall::subexpr!([] : List ({ index : Natural, value : t })), rest, ), (ListIndexed, [_, NEListLit(xs), rest..]) => { @@ -78,7 +78,7 @@ where .enumerate() .map(|(i, e)| { let i = rc(NaturalLit(i)); - dhall_expr!({ index = i, value = e }) + dhall::subexpr!({ index = i, value = e }) }) .collect(); (rc(NEListLit(xs)), rest) @@ -100,7 +100,7 @@ where let a1 = shift(1, &V("x".into(), 0), &a0); let g = g.roll(); break 'ret ( - dhall_expr!( + dhall::subexpr!( g (List a0) (λ(x : a0) -> λ(xs : List a1) -> [ x ] # xs) @@ -126,7 +126,7 @@ where let a0 = a0.roll(); let g = g.roll(); break 'ret ( - dhall_expr!( + dhall::subexpr!( g (Optional a0) (λ(x: a0) -> Some x) @@ -144,7 +144,7 @@ where let x = x.clone(); let acc = acc.clone(); let cons = cons.roll(); - dhall_expr!(cons x acc) + dhall::subexpr!(cons x acc) }), rest, ), @@ -155,7 +155,7 @@ where (OptionalFold, [_, NEOptionalLit(x), _, just, _, rest..]) => { let x = x.clone(); let just = just.roll(); - (dhall_expr!(just x), rest) + (dhall::subexpr!(just x), rest) } (OptionalFold, [_, EmptyOptionalLit(_), _, _, nothing, rest..]) => { (nothing.roll(), rest) @@ -179,7 +179,7 @@ where }; let g = g.roll(); break 'ret ( - dhall_expr!(g Natural (λ(x : Natural) -> x + 1) 0), + dhall::subexpr!(g Natural (λ(x : Natural) -> x + 1) 0), rest, ); } @@ -193,7 +193,7 @@ where let t = t.roll(); let succ = succ.roll(); let zero = zero.roll(); - (dhall_expr!(succ (fold n t succ zero)), rest) + (dhall::subexpr!(succ (fold n t succ zero)), rest) } // (NaturalFold, Some(App(f2, args2)), _) => { // match (f2.as_ref(), args2.as_slice()) { diff --git a/dhall/src/traits/static_type.rs b/dhall/src/traits/static_type.rs index 444f464..e92ce78 100644 --- a/dhall/src/traits/static_type.rs +++ b/dhall/src/traits/static_type.rs @@ -1,6 +1,6 @@ use crate::expr::*; use dhall_core::*; -use dhall_generator::*; +use dhall_generator as dhall; /// A value that has a statically-known Dhall type. /// @@ -57,49 +57,49 @@ impl<'a> StaticType for SimpleType<'a> { impl SimpleStaticType for bool { fn get_simple_static_type<'a>() -> SimpleType<'a> { - mktype(dhall_expr!(Bool)) + mktype(dhall::subexpr!(Bool)) } } impl SimpleStaticType for Natural { fn get_simple_static_type<'a>() -> SimpleType<'a> { - mktype(dhall_expr!(Natural)) + mktype(dhall::subexpr!(Natural)) } } impl SimpleStaticType for u32 { fn get_simple_static_type<'a>() -> SimpleType<'a> { - mktype(dhall_expr!(Natural)) + mktype(dhall::subexpr!(Natural)) } } impl SimpleStaticType for u64 { fn get_simple_static_type<'a>() -> SimpleType<'a> { - mktype(dhall_expr!(Natural)) + mktype(dhall::subexpr!(Natural)) } } impl SimpleStaticType for Integer { fn get_simple_static_type<'a>() -> SimpleType<'a> { - mktype(dhall_expr!(Integer)) + mktype(dhall::subexpr!(Integer)) } } impl SimpleStaticType for i32 { fn get_simple_static_type<'a>() -> SimpleType<'a> { - mktype(dhall_expr!(Integer)) + mktype(dhall::subexpr!(Integer)) } } impl SimpleStaticType for i64 { fn get_simple_static_type<'a>() -> SimpleType<'a> { - mktype(dhall_expr!(Integer)) + mktype(dhall::subexpr!(Integer)) } } impl SimpleStaticType for String { fn get_simple_static_type<'a>() -> SimpleType<'a> { - mktype(dhall_expr!(Text)) + mktype(dhall::subexpr!(Text)) } } @@ -107,21 +107,21 @@ impl<A: SimpleStaticType, B: SimpleStaticType> SimpleStaticType for (A, B) { fn get_simple_static_type<'a>() -> SimpleType<'a> { let ta: SubExpr<_, _> = A::get_simple_static_type().into(); let tb: SubExpr<_, _> = B::get_simple_static_type().into(); - mktype(dhall_expr!({ _1: ta, _2: tb })) + mktype(dhall::subexpr!({ _1: ta, _2: tb })) } } impl<T: SimpleStaticType> SimpleStaticType for Option<T> { fn get_simple_static_type<'a>() -> SimpleType<'a> { let t: SubExpr<_, _> = T::get_simple_static_type().into(); - mktype(dhall_expr!(Optional t)) + mktype(dhall::subexpr!(Optional t)) } } impl<T: SimpleStaticType> SimpleStaticType for Vec<T> { fn get_simple_static_type<'a>() -> SimpleType<'a> { let t: SubExpr<_, _> = T::get_simple_static_type().into(); - mktype(dhall_expr!(List t)) + mktype(dhall::subexpr!(List t)) } } @@ -133,7 +133,7 @@ impl<'a, T: SimpleStaticType> SimpleStaticType for &'a T { impl<T> SimpleStaticType for std::marker::PhantomData<T> { fn get_simple_static_type<'a>() -> SimpleType<'a> { - mktype(dhall_expr!({})) + mktype(dhall::subexpr!({})) } } @@ -143,6 +143,6 @@ impl<T: SimpleStaticType, E: SimpleStaticType> SimpleStaticType fn get_simple_static_type<'a>() -> SimpleType<'a> { let tt: SubExpr<_, _> = T::get_simple_static_type().into(); let te: SubExpr<_, _> = E::get_simple_static_type().into(); - mktype(dhall_expr!(< Ok: tt | Err: te>)) + mktype(dhall::subexpr!(< Ok: tt | Err: te>)) } } |