5494f396552a14a0bb18267aae91b418de131e9c
[hope.git] / src / hope_dictionary.erl
1 -module(hope_dictionary).
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
18 -callback set(t(K, V), K, V) ->
19 t(K, V).
20
21 -callback update(t(K, V), K, fun((hope_option:t(V)) -> V)) ->
22 t(K, V).
23
24 -callback map(t(K, V), fun((K, V) -> V)) ->
25 t(K, V).
26
27 -callback filter(t(K, V), fun((K, V) -> boolean())) ->
28 t(K, V).
29
30 -callback fold(t(K, V), fun((K, V, Acc) -> Acc), Acc) ->
31 Acc.
32
33 -callback iter(t(K, V), fun((K, V) -> ok)) ->
34 ok.
35
36 %% TODO: Decide if validation is to be done. If yes - wrap in hope_result:t/1
37 -callback of_kv_list([{K, V}]) ->
38 t(K, V).
39
40 -callback to_kv_list(t(K, V)) ->
41 [{K, V}].
This page took 0.05832 seconds and 3 git commands to generate.