summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/builtins.rs
diff options
context:
space:
mode:
authorNadrieril2020-01-30 19:49:03 +0000
committerNadrieril2020-01-30 19:49:03 +0000
commit673a580e11d31356bec25d73213b283685fd6ea3 (patch)
treede57a878865102d16efe884049d91dd30624d3aa /dhall/src/semantics/builtins.rs
parent40336a928dfc3d1f96273d39ba564334b1719344 (diff)
Clarify normalization to ensure we only nze once
Diffstat (limited to 'dhall/src/semantics/builtins.rs')
-rw-r--r--dhall/src/semantics/builtins.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/dhall/src/semantics/builtins.rs b/dhall/src/semantics/builtins.rs
index 1357adf..85ef294 100644
--- a/dhall/src/semantics/builtins.rs
+++ b/dhall/src/semantics/builtins.rs
@@ -12,7 +12,7 @@ use std::collections::HashMap;
use std::convert::TryInto;
/// A partially applied builtin.
-/// Invariant: TODO
+/// Invariant: the evaluation of the given args must not be able to progress further
#[derive(Debug, Clone)]
pub(crate) struct BuiltinClosure<Value> {
pub env: NzEnv,
@@ -41,9 +41,8 @@ impl BuiltinClosure<Value> {
let types = self.types.iter().cloned().chain(once(f_ty)).collect();
apply_builtin(self.b, args, ret_ty, types, self.env.clone())
}
- pub fn ensure_whnf(self, ret_ty: &Value) -> ValueKind {
- apply_builtin(self.b, self.args, ret_ty, self.types, self.env)
- }
+ /// This doesn't break the invariant because we already checked that the appropriate arguments
+ /// did not normalize to something that allows evaluation to proceed.
pub fn normalize_mut(&mut self) {
for x in self.args.iter_mut() {
x.normalize_mut();