Ignore outputs of side-effecting, element-handler functions.
[hope.git] / src / hope_gen_dictionary.erl
CommitLineData
b69220d7 1-module(hope_gen_dictionary).
cd69f1f3
SK
2
3-export_type(
4 [ t/2
5 ]).
6
7
8-type t(_Key, _Value) ::
9 term().
10
11
12-callback empty() ->
13 t(_K, _V).
14
15-callback get(t(K, V), K) ->
16 hope_option:t(V).
17
870172d6
SK
18-callback get(t(K, V), K, V) ->
19 V.
20
e0fbc1da
SK
21-callback get(t(K, V), K, V, fun((V) -> boolean())) ->
22 V.
23
cd69f1f3
SK
24-callback set(t(K, V), K, V) ->
25 t(K, V).
26
27-callback update(t(K, V), K, fun((hope_option:t(V)) -> V)) ->
28 t(K, V).
29
70cf8e86
SK
30-callback pop(t(K, V), K) ->
31 {hope_option:t(V), t(K, V)}.
32
cd69f1f3
SK
33-callback map(t(K, V), fun((K, V) -> V)) ->
34 t(K, V).
35
36-callback filter(t(K, V), fun((K, V) -> boolean())) ->
37 t(K, V).
38
39-callback fold(t(K, V), fun((K, V, Acc) -> Acc), Acc) ->
40 Acc.
41
0ed4baeb 42-callback iter(t(K, V), fun((K, V) -> any())) ->
cd69f1f3
SK
43 ok.
44
37c6e98b 45%% TODO: Decide if validation is to be done. If yes - wrap in hope_result:t/1
cd69f1f3
SK
46-callback of_kv_list([{K, V}]) ->
47 t(K, V).
48
49-callback to_kv_list(t(K, V)) ->
50 [{K, V}].
67535be2
SK
51
52-callback has_key(t(K, _), K) ->
53 boolean().
This page took 0.023657 seconds and 4 git commands to generate.