summaryrefslogtreecommitdiff
path: root/dhall/src
diff options
context:
space:
mode:
authorNadrieril2020-02-18 18:46:26 +0000
committerNadrieril2020-02-18 18:46:26 +0000
commit50a9dc4b9af19a35a983fe17108453d1d82d80ed (patch)
tree98346d61e73e565d9ae0b3f28468784f1601714a /dhall/src
parentebe43bd6f1fd6feb1564ab9837399de7808b67b5 (diff)
Remove useless `normalize` option from ToExprOptions
Diffstat (limited to 'dhall/src')
-rw-r--r--dhall/src/lib.rs19
-rw-r--r--dhall/src/semantics/nze/nir.rs3
-rw-r--r--dhall/src/semantics/resolve/hir.rs10
3 files changed, 6 insertions, 26 deletions
diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs
index c329c66..c2f5020 100644
--- a/dhall/src/lib.rs
+++ b/dhall/src/lib.rs
@@ -51,7 +51,7 @@ pub struct Typed {
/// A normalized expression.
///
-/// Invariant: the contained Typed expression must be in normal form,
+/// Invariant: the contained expression must be in normal form,
#[derive(Debug, Clone)]
pub struct Normalized(Nir);
@@ -60,8 +60,6 @@ pub struct Normalized(Nir);
pub(crate) struct ToExprOptions {
/// Whether to convert all variables to `_`
pub(crate) alpha: bool,
- /// Whether to normalize before converting
- pub(crate) normalize: bool,
}
impl Parsed {
@@ -122,10 +120,7 @@ impl Typed {
/// Converts a value back to the corresponding AST expression.
fn to_expr(&self) -> ResolvedExpr {
- self.hir.to_expr(ToExprOptions {
- alpha: false,
- normalize: false,
- })
+ self.hir.to_expr(ToExprOptions { alpha: false })
}
pub(crate) fn get_type(&self) -> Result<Normalized, TypeError> {
@@ -140,10 +135,7 @@ impl Normalized {
/// Converts a value back to the corresponding AST expression.
pub fn to_expr(&self) -> NormalizedExpr {
- self.0.to_expr(ToExprOptions {
- alpha: false,
- normalize: false,
- })
+ self.0.to_expr(ToExprOptions { alpha: false })
}
/// Converts a value back to the corresponding Hir expression.
pub(crate) fn to_hir(&self) -> Hir {
@@ -151,10 +143,7 @@ impl Normalized {
}
/// 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 {
- alpha: true,
- normalize: false,
- })
+ self.0.to_expr(ToExprOptions { alpha: true })
}
pub(crate) fn to_nir(&self) -> Nir {
self.0.clone()
diff --git a/dhall/src/semantics/nze/nir.rs b/dhall/src/semantics/nze/nir.rs
index 44a23fe..4ed66b7 100644
--- a/dhall/src/semantics/nze/nir.rs
+++ b/dhall/src/semantics/nze/nir.rs
@@ -137,9 +137,6 @@ impl Nir {
}
/// Converts a value back to the corresponding AST expression.
pub(crate) fn to_expr(&self, opts: ToExprOptions) -> NormalizedExpr {
- if opts.normalize {
- self.normalize();
- }
self.to_hir_noenv().to_expr(opts)
}
pub(crate) fn to_expr_tyenv(&self, tyenv: &TyEnv) -> NormalizedExpr {
diff --git a/dhall/src/semantics/resolve/hir.rs b/dhall/src/semantics/resolve/hir.rs
index d421718..d0bec5a 100644
--- a/dhall/src/semantics/resolve/hir.rs
+++ b/dhall/src/semantics/resolve/hir.rs
@@ -54,17 +54,11 @@ impl Hir {
}
/// Converts a closed Hir expr back to the corresponding AST expression.
pub fn to_expr_noopts(&self) -> NormalizedExpr {
- let opts = ToExprOptions {
- normalize: false,
- alpha: false,
- };
+ let opts = ToExprOptions { alpha: false };
self.to_expr(opts)
}
pub fn to_expr_tyenv(&self, env: &TyEnv) -> NormalizedExpr {
- let opts = ToExprOptions {
- normalize: true,
- alpha: false,
- };
+ let opts = ToExprOptions { alpha: false };
let mut env = env.as_nameenv().clone();
hir_to_expr(self, opts, &mut env)
}