summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
authorNadrieril2019-03-31 19:08:08 +0200
committerNadrieril2019-03-31 19:08:08 +0200
commit7374d0524ccd53b256107667b213597c05720d2d (patch)
tree69dc0e324ffbe3ecf928c62f4e900000f11c5386 /dhall
parentbfe3f7f75570540fa184a133653d16e86f22667a (diff)
Move recursion out of Expr
Diffstat (limited to 'dhall')
-rw-r--r--dhall/src/binary.rs4
-rw-r--r--dhall/src/normalize.rs6
-rw-r--r--dhall/src/typecheck.rs6
-rw-r--r--dhall/tests/common/mod.rs2
4 files changed, 9 insertions, 9 deletions
diff --git a/dhall/src/binary.rs b/dhall/src/binary.rs
index 988891b..1ba1873 100644
--- a/dhall/src/binary.rs
+++ b/dhall/src/binary.rs
@@ -20,10 +20,10 @@ pub fn decode(data: &[u8]) -> Result<ParsedExpr, DecodeError> {
fn cbor_value_to_dhall(data: &cbor::Value) -> Result<ParsedExpr, DecodeError> {
use cbor::Value::*;
use dhall_core::{BinOp, Builtin, Const};
- use Expr::*;
+ use ExprF::*;
Ok(rc(match data {
String(s) => match Builtin::parse(s) {
- Some(b) => Expr::Builtin(b),
+ Some(b) => ExprF::Builtin(b),
None => match s.as_str() {
"True" => BoolLit(true),
"False" => BoolLit(false),
diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs
index 5405e88..c6c294c 100644
--- a/dhall/src/normalize.rs
+++ b/dhall/src/normalize.rs
@@ -12,7 +12,7 @@ where
A: fmt::Debug,
{
use dhall_core::Builtin::*;
- use dhall_core::Expr::*;
+ use dhall_core::ExprF::*;
let f = rc(Builtin(b));
// How many arguments a builtin needs, and which argument
// should be normalized and pattern-matched
@@ -199,7 +199,7 @@ where
// Put the remaining arguments back and eval again. In most cases
// ret will not be of a form that can be applied, so this won't go very deep.
// In lots of cases, there are no remaining args so this cann will just return ret.
- normalize_whnf(&rc(Expr::App(ret, args.split_off(len_consumption))))
+ normalize_whnf(&rc(ExprF::App(ret, args.split_off(len_consumption))))
}
/// Reduce an expression to its weak head normal form, i.e. normalize
@@ -213,7 +213,7 @@ where
A: fmt::Debug,
{
use dhall_core::BinOp::*;
- use dhall_core::Expr::*;
+ use dhall_core::ExprF::*;
match e.as_ref() {
Let(f, _, r, b) => {
let vf0 = &V(f.clone(), 0);
diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs
index e769c7f..31702db 100644
--- a/dhall/src/typecheck.rs
+++ b/dhall/src/typecheck.rs
@@ -12,7 +12,7 @@ use self::TypeMessage::*;
fn axiom<S>(c: Const) -> Result<Const, TypeError<S>> {
use dhall_core::Const::*;
- use dhall_core::Expr::*;
+ use dhall_core::ExprF::*;
match c {
Type => Ok(Kind),
Kind => Err(TypeError::new(&Context::new(), rc(Const(Kind)), Untyped)),
@@ -53,7 +53,7 @@ where
S: ::std::fmt::Debug,
T: ::std::fmt::Debug,
{
- use dhall_core::Expr::*;
+ use dhall_core::ExprF::*;
fn go<S, T>(
ctx: &mut Vec<(Label, Label)>,
el: &Expr<S, X>,
@@ -192,7 +192,7 @@ where
use dhall_core::BinOp::*;
use dhall_core::Builtin::*;
use dhall_core::Const::*;
- use dhall_core::Expr::*;
+ use dhall_core::ExprF::*;
let mkerr = |msg: TypeMessage<_>| TypeError::new(ctx, e.clone(), msg);
let ensure_const = |x: &SubExpr<_, _>, msg: TypeMessage<_>| match x.as_ref()
{
diff --git a/dhall/tests/common/mod.rs b/dhall/tests/common/mod.rs
index 6b893e0..325b80f 100644
--- a/dhall/tests/common/mod.rs
+++ b/dhall/tests/common/mod.rs
@@ -111,7 +111,7 @@ pub fn run_test(base_path: &str, feature: Feature) {
let expected_file_path = base_path + "B.dhall";
let expr = rc(read_dhall_file(&expr_file_path).unwrap());
let expected = rc(read_dhall_file(&expected_file_path).unwrap());
- typecheck::type_of(rc(Expr::Annot(expr, expected))).unwrap();
+ typecheck::type_of(rc(ExprF::Annot(expr, expected))).unwrap();
}
}
}