diff options
author | Nadrieril | 2019-03-09 00:42:46 +0100 |
---|---|---|
committer | Nadrieril | 2019-03-09 00:43:13 +0100 |
commit | 505e6a34cc5aadac1831d31ef64b94b61c2ace13 (patch) | |
tree | 1cca4b507552df613c9852d755e9ada8dee67d7d /dhall_core/src/core.rs | |
parent | c6aafe818ca56ec8bc6d3cd27824eba0a2d6b874 (diff) |
First import works !
Diffstat (limited to 'dhall_core/src/core.rs')
-rw-r--r-- | dhall_core/src/core.rs | 10 |
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 |