summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/phase/mod.rs
diff options
context:
space:
mode:
authorNadrieril2019-12-24 21:46:29 +0000
committerNadrieril2019-12-24 21:46:29 +0000
commitf5a588defc0ad22ce2f0d3b32ef8f0e22e43e672 (patch)
tree405bcef717b1a7ab0ec8de898ca5264698c39362 /dhall/src/semantics/phase/mod.rs
parent611d4ced3a5ffca8b9765971001995a216dbbb54 (diff)
Ensure inferred type is always in normal form
Diffstat (limited to 'dhall/src/semantics/phase/mod.rs')
-rw-r--r--dhall/src/semantics/phase/mod.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/dhall/src/semantics/phase/mod.rs b/dhall/src/semantics/phase/mod.rs
index b22120d..5332eb3 100644
--- a/dhall/src/semantics/phase/mod.rs
+++ b/dhall/src/semantics/phase/mod.rs
@@ -63,6 +63,11 @@ impl Parsed {
pub fn encode(&self) -> Result<Vec<u8>, EncodeError> {
binary::encode(&self.0)
}
+
+ /// Converts a value back to the corresponding AST expression.
+ pub fn to_expr(&self) -> ParsedExpr {
+ self.0.clone()
+ }
}
impl Resolved {
@@ -73,6 +78,10 @@ impl Resolved {
Ok(typecheck::typecheck_with(self.0, ty.normalize_to_expr())?
.into_typed())
}
+ /// Converts a value back to the corresponding AST expression.
+ pub fn to_expr(&self) -> ResolvedExpr {
+ self.0.clone()
+ }
}
impl Typed {
@@ -96,7 +105,7 @@ impl Typed {
}
/// Converts a value back to the corresponding AST expression.
- pub(crate) fn to_expr(&self) -> NormalizedExpr {
+ pub fn to_expr(&self) -> ResolvedExpr {
self.0.to_expr(ToExprOptions {
alpha: false,
normalize: false,