Add get with default to dictionary interface.
[hope.git] / src / hope_kv_list.erl
index be11c31..d9a8177 100644 (file)
@@ -12,6 +12,7 @@
 -export(
     [ empty/0
     , get/2
+    , get/3
     , set/3
     , update/3
     , pop/2
@@ -53,6 +54,12 @@ get(T, K) ->
     ;   {K, V} -> {some, V}
     end.
 
+-spec get(t(K, V), K, V) ->
+    V.
+get(T, K, Default) ->
+    Vopt = get(T, K),
+    hope_option:get(Vopt, Default).
+
 -spec set(t(K, V), K, V) ->
     t(K, V).
 set(T, K, V) ->
This page took 0.019905 seconds and 4 git commands to generate.