diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs index 1210e0f9a..f6583db5a 100644 --- a/tvix/eval/src/value/mod.rs +++ b/tvix/eval/src/value/mod.rs @@ -113,6 +113,17 @@ impl Value { } } + pub fn to_closure(self) -> EvalResult { + match self { + Value::Closure(c) => Ok(c), + other => Err(ErrorKind::TypeError { + expected: "lambda", + actual: other.type_of(), + } + .into()), + } + } + pub fn is_bool(&self) -> bool { matches!(self, Value::Bool(_)) }