summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/phase
diff options
context:
space:
mode:
authorNadrieril2019-12-17 16:00:51 +0000
committerNadrieril2019-12-19 21:34:07 +0000
commitfd665388b6f1fd80ded9010640ac65cfebca7bc6 (patch)
treec37c09bd1566805c7280d96deda1d23e7f4e9d63 /dhall/src/semantics/phase
parent30bbf22fbfaead80322888eba7b7acdf908c3f3e (diff)
Move out conversion from value back to ast to its own file
Diffstat (limited to 'dhall/src/semantics/phase')
-rw-r--r--dhall/src/semantics/phase/mod.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/dhall/src/semantics/phase/mod.rs b/dhall/src/semantics/phase/mod.rs
index f27088c..6229d15 100644
--- a/dhall/src/semantics/phase/mod.rs
+++ b/dhall/src/semantics/phase/mod.rs
@@ -1,10 +1,11 @@
use std::fmt::Display;
use std::path::Path;
-use crate::semantics::core::value::{ToExprOptions, Value};
+use crate::semantics::core::value::Value;
use crate::semantics::core::value_kind::ValueKind;
use crate::semantics::core::var::{AlphaVar, Shift, Subst};
use crate::semantics::error::{EncodeError, Error, ImportError, TypeError};
+use crate::semantics::to_expr::ToExprOptions;
use crate::syntax::binary;
use crate::syntax::{Builtin, Const, Expr};
use resolve::ImportRoot;
@@ -101,18 +102,22 @@ impl Typed {
Typed::from_const(Const::Type)
}
+ /// Converts a value back to the corresponding AST expression.
pub(crate) fn to_expr(&self) -> NormalizedExpr {
self.0.to_expr(ToExprOptions {
alpha: false,
normalize: false,
})
}
+ /// Converts a value back to the corresponding AST expression, normalizing in the process.
pub fn normalize_to_expr(&self) -> NormalizedExpr {
self.0.to_expr(ToExprOptions {
alpha: false,
normalize: true,
})
}
+ /// Converts a value back to the corresponding AST expression, (akpha,beta)-normalizing in the
+ /// process.
pub(crate) fn normalize_to_expr_alpha(&self) -> NormalizedExpr {
self.0.to_expr(ToExprOptions {
alpha: true,