aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/source/lux/data/coll/dictionary/ordered.lux6
1 files changed, 6 insertions, 0 deletions
diff --git a/stdlib/source/lux/data/coll/dictionary/ordered.lux b/stdlib/source/lux/data/coll/dictionary/ordered.lux
index 16412e648..aec44d943 100644
--- a/stdlib/source/lux/data/coll/dictionary/ordered.lux
+++ b/stdlib/source/lux/data/coll/dictionary/ordered.lux
@@ -519,6 +519,12 @@
(set@ #root (#.Some (blacken root)) dict)
)))
+(def: #export (update key transform dict)
+ (All [k v] (-> k (-> v v) (Dict k v) (Maybe (Dict k v))))
+ (do maybe.Monad<Maybe>
+ [old (get key dict)]
+ (wrap (put key (transform old) dict))))
+
(def: #export (from-list Order<l> list)
(All [k v] (-> (Order k) (List [k v]) (Dict k v)))
(L/fold (function (_ [key value] dict)