summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
authorNadrieril2019-05-07 16:01:24 +0200
committerNadrieril2019-05-07 16:01:24 +0200
commit726c281cdd3824fcfdde34fe8d01f95416f7808c (patch)
treea3a7b89348a1f63208b3912d45e0ecd6d3f344a3 /dhall
parent1b8a67353a0167bdafd0b8cc03f5d83464f7af3d (diff)
Clean up some of the SubExpr type-changing methods
Diffstat (limited to 'dhall')
-rw-r--r--dhall/src/core/thunk.rs4
-rw-r--r--dhall/src/phase/parse.rs2
-rw-r--r--dhall/src/phase/typecheck.rs6
3 files changed, 6 insertions, 6 deletions
diff --git a/dhall/src/core/thunk.rs b/dhall/src/core/thunk.rs
index 8775ce2..69c4347 100644
--- a/dhall/src/core/thunk.rs
+++ b/dhall/src/core/thunk.rs
@@ -126,7 +126,7 @@ impl Thunk {
}
pub(crate) fn from_normalized_expr(e: OutputSubExpr) -> Thunk {
- Thunk::new(NormalizationContext::new(), e.embed_absurd().note_absurd())
+ Thunk::new(NormalizationContext::new(), e.absurd())
}
// Normalizes contents to normal form; faster than `normalize_nf` if
@@ -253,7 +253,7 @@ impl TypeThunk {
TypeThunk::Type(t) => Ok(t.clone()),
TypeThunk::Thunk(th) => {
// TODO: rule out statically
- mktype(ctx, th.normalize_to_expr().embed_absurd().note_absurd())
+ mktype(ctx, th.normalize_to_expr().absurd())
}
}
}
diff --git a/dhall/src/phase/parse.rs b/dhall/src/phase/parse.rs
index 809faf4..6b426af 100644
--- a/dhall/src/phase/parse.rs
+++ b/dhall/src/phase/parse.rs
@@ -13,7 +13,7 @@ pub(crate) fn parse_file(f: &Path) -> Result<Parsed, Error> {
File::open(f)?.read_to_string(&mut buffer)?;
let expr = parse_expr(&*buffer)?;
let root = ImportRoot::LocalDir(f.parent().unwrap().to_owned());
- Ok(Parsed(expr.unnote().note_absurd(), root))
+ Ok(Parsed(expr, root))
}
pub(crate) fn parse_str(s: &str) -> Result<Parsed, Error> {
diff --git a/dhall/src/phase/typecheck.rs b/dhall/src/phase/typecheck.rs
index 3e6986f..32c1531 100644
--- a/dhall/src/phase/typecheck.rs
+++ b/dhall/src/phase/typecheck.rs
@@ -230,7 +230,7 @@ pub(crate) fn type_of_const(c: Const) -> Result<Type, TypeError> {
}
}
-fn type_of_builtin<E>(b: Builtin) -> Expr<X, E> {
+fn type_of_builtin(b: Builtin) -> Expr<X, X> {
use dhall_syntax::Builtin::*;
match b {
Bool | Natural | Integer | Double | Text => dhall::expr!(Type),
@@ -635,7 +635,7 @@ fn type_last_layer(
}
Const(c) => Ok(RetTyped(Typed::from_const(c))),
Builtin(b) => {
- Ok(RetType(mktype(ctx, rc(type_of_builtin(b)).note_absurd())?))
+ Ok(RetType(mktype(ctx, rc(type_of_builtin(b)).absurd())?))
}
BoolLit(_) => Ok(RetType(builtin_to_type(Bool)?)),
NaturalLit(_) => Ok(RetType(builtin_to_type(Natural)?)),
@@ -712,7 +712,7 @@ pub(crate) fn typecheck_with(
ty: &Type,
) -> Result<Typed, TypeError> {
let expr: SubExpr<_, _> = e.0;
- let ty: SubExpr<_, _> = ty.to_expr().embed_absurd().note_absurd();
+ let ty: SubExpr<_, _> = ty.to_expr().absurd();
type_of(expr.rewrap(ExprF::Annot(expr.clone(), ty)))
}
pub(crate) fn skip_typecheck(e: Resolved) -> Typed {