X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=src%2Fhope_gen_dictionary.erl;h=c0b7e5348dc392782668f1d5e97102239c1aa142;hb=4744fed98ce752dde11c03aeaf8d90983efe5ea6;hp=dda6eb06bf4ca500380de1c4e4e941c9580434d5;hpb=870172d69230ad2cf0f409ec009ab3feaa723fee;p=hope.git diff --git a/src/hope_gen_dictionary.erl b/src/hope_gen_dictionary.erl index dda6eb0..c0b7e53 100644 --- a/src/hope_gen_dictionary.erl +++ b/src/hope_gen_dictionary.erl @@ -18,6 +18,9 @@ -callback get(t(K, V), K, V) -> V. +-callback get(t(K, V), K, V, fun((V) -> boolean())) -> + V. + -callback set(t(K, V), K, V) -> t(K, V). @@ -36,8 +39,8 @@ -callback fold(t(K, V), fun((K, V, Acc) -> Acc), Acc) -> Acc. --callback iter(t(K, V), fun((K, V) -> ok)) -> - ok. +-callback iter(t(K, V), fun((K, V) -> any())) -> + {}. %% TODO: Decide if validation is to be done. If yes - wrap in hope_result:t/1 -callback of_kv_list([{K, V}]) -> @@ -45,3 +48,6 @@ -callback to_kv_list(t(K, V)) -> [{K, V}]. + +-callback has_key(t(K, _), K) -> + boolean().