1 -module(hope_dictionary).
8 -type t(_Key, _Value) ::
15 -callback get(t(K, V), K) ->
18 -callback set(t(K, V), K, V) ->
21 -callback update(t(K, V), K, fun((hope_option:t(V)) -> V)) ->
24 -callback pop(t(K, V), K) ->
25 {hope_option:t(V), t(K, V)}.
27 -callback map(t(K, V), fun((K, V) -> V)) ->
30 -callback filter(t(K, V), fun((K, V) -> boolean())) ->
33 -callback fold(t(K, V), fun((K, V, Acc) -> Acc), Acc) ->
36 -callback iter(t(K, V), fun((K, V) -> ok)) ->
39 %% TODO: Decide if validation is to be done. If yes - wrap in hope_result:t/1
40 -callback of_kv_list([{K, V}]) ->
43 -callback to_kv_list(t(K, V)) ->