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