summaryrefslogtreecommitdiff
path: root/dhall_core/src/core.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dhall_core/src/core.rs')
-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 72389c5..3b98b39 100644
--- a/dhall_core/src/core.rs
+++ b/dhall_core/src/core.rs
@@ -376,6 +376,16 @@ impl<'i, S: Clone, A: Clone> Expr<&'i str, S, A> {
}
}
+impl<L: StringLike, S: Clone, A: Clone> Expr<L, S, Expr<L, S, A>> {
+ pub fn squash_embed(&self) -> Expr<L, S, A>
+ {
+ match self {
+ Expr::Embed(e) => e.clone(),
+ e => e.map_shallow(|e| e.squash_embed(), |x| x.clone(), |_| unreachable!(), |x| x.clone())
+ }
+ }
+}
+
// There is a one-to-one correspondence between the formatters in this section
// and the grammar in grammar.lalrpop. Each formatter is named after the
// corresponding grammar rule and the relationship between formatters exactly matches