summaryrefslogtreecommitdiff
path: root/dhall_core/src
diff options
context:
space:
mode:
Diffstat (limited to 'dhall_core/src')
-rw-r--r--dhall_core/src/core.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs
index 3d1b9f3..2f15217 100644
--- a/dhall_core/src/core.rs
+++ b/dhall_core/src/core.rs
@@ -739,3 +739,13 @@ pub fn subst<S, A>(
_ => in_expr.map_ref(|e| subst(var, value, e), under_binder),
}
}
+
+pub fn subst_shift<S, A>(
+ var: &V<Label>,
+ value: &SubExpr<S, A>,
+ in_expr: &SubExpr<S, A>,
+) -> SubExpr<S, A> {
+ let value = shift(1, var, value);
+ let expr = subst(var, &value, in_expr);
+ shift(-1, var, &expr)
+}