summaryrefslogtreecommitdiff
path: root/dhall_core
diff options
context:
space:
mode:
Diffstat (limited to 'dhall_core')
-rw-r--r--dhall_core/src/context.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/dhall_core/src/context.rs b/dhall_core/src/context.rs
index 91eec69..55bfff5 100644
--- a/dhall_core/src/context.rs
+++ b/dhall_core/src/context.rs
@@ -41,11 +41,13 @@ impl<K: Hash + Eq + Clone, T> Context<K, T> {
})
}
- pub fn map<U, F: Fn(&T) -> U>(&self, f: F) -> Context<K, U> {
+ pub fn map<U, F: Fn(&K, &T) -> U>(&self, f: F) -> Context<K, U> {
Context(
self.0
.iter()
- .map(|(k, v)| ((*k).clone(), v.iter().map(&f).collect()))
+ .map(|(k, vs)| {
+ ((*k).clone(), vs.iter().map(|v| f(k, v)).collect())
+ })
.collect(),
)
}