aboutsummaryrefslogtreecommitdiff
path: root/src/client/Utils/Dict.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Utils/Dict.elm')
-rw-r--r--src/client/Utils/Dict.elm11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/client/Utils/Dict.elm b/src/client/Utils/Dict.elm
new file mode 100644
index 0000000..dc01b17
--- /dev/null
+++ b/src/client/Utils/Dict.elm
@@ -0,0 +1,11 @@
+module Utils.Dict
+ ( mapValues
+ ) where
+
+import Dict as Dict exposing (..)
+
+mapValues : (a -> b) -> Dict comparable a -> Dict comparable b
+mapValues f = Dict.fromList << List.map (onSecond f) << Dict.toList
+
+onSecond : (a -> b) -> (comparable, a) -> (comparable, b)
+onSecond f tuple = case tuple of (x, y) -> (x, f y)