summaryrefslogtreecommitdiff
path: root/dhall/src/lib.rs
diff options
context:
space:
mode:
authorNadrieril2020-02-09 21:58:28 +0000
committerNadrieril2020-02-09 21:58:28 +0000
commit21db63d3e614554f258526182c7ed89a2c244b65 (patch)
treeb222217123f53774e2c5c70160c3fc48e08045fc /dhall/src/lib.rs
parenta709c65eb28f1b6a666f15bfc2255da7bc7105ab (diff)
Take Hir for typecheck
Diffstat (limited to '')
-rw-r--r--dhall/src/lib.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs
index c2a2f19..2d261f9 100644
--- a/dhall/src/lib.rs
+++ b/dhall/src/lib.rs
@@ -79,7 +79,7 @@ impl Parsed {
resolve::resolve(self)
}
pub fn skip_resolve(self) -> Result<Resolved, Error> {
- resolve::skip_resolve_expr(self)
+ Ok(Resolved(resolve::skip_resolve(&self.0)?))
}
pub fn encode(&self) -> Result<Vec<u8>, EncodeError> {
@@ -94,10 +94,10 @@ impl Parsed {
impl Resolved {
pub fn typecheck(&self) -> Result<Typed, TypeError> {
- Ok(Typed(typecheck(&self.to_expr())?))
+ Ok(Typed(typecheck(&self.0)?))
}
pub fn typecheck_with(self, ty: &Normalized) -> Result<Typed, TypeError> {
- Ok(Typed(typecheck_with(&self.to_expr(), ty.to_expr())?))
+ Ok(Typed(typecheck_with(&self.0, ty.to_hir())?))
}
/// Converts a value back to the corresponding AST expression.
pub fn to_expr(&self) -> ResolvedExpr {
@@ -136,6 +136,10 @@ impl Normalized {
normalize: false,
})
}
+ /// Converts a value back to the corresponding Hir expression.
+ pub(crate) fn to_hir(&self) -> Hir {
+ self.0.to_hir_noenv()
+ }
/// Converts a value back to the corresponding AST expression, alpha-normalizing in the process.
pub(crate) fn to_expr_alpha(&self) -> NormalizedExpr {
self.0.to_expr(ToExprOptions {