X-Git-Url: https://git.xandkar.net/?p=hope.git;a=blobdiff_plain;f=src%2Fhope_kv_list.erl;h=7b25797ed3b9ef0b57c660e1f4665a1a45adaba8;hp=2000098244cf5cd9d7c5a4e92b2dbb3c824d50f8;hb=99fd18ae3aa61238700208a5f2b2959c1b1a2d80;hpb=dfcd229cc57d908ee6f5c3d6d7b57e0f5364e2b2 diff --git a/src/hope_kv_list.erl b/src/hope_kv_list.erl index 2000098..7b25797 100644 --- a/src/hope_kv_list.erl +++ b/src/hope_kv_list.erl @@ -131,14 +131,16 @@ of_kv_list(List) -> % TODO: Decide if validation is to be done here. Do so if yes. List. --spec validate_unique_presence(t(K, _V), [K]) -> - hope_result:t(ok, [presence_error(K)]). +-spec validate_unique_presence(T, [K]) -> + hope_result:t(T, [presence_error(K)]) + when T :: t(K, _V). validate_unique_presence(T, KeysRequired) -> KeysOptional = [], validate_unique_presence(T, KeysRequired, KeysOptional). -spec validate_unique_presence(t(K, _V), [K], [K]) -> - hope_result:t(ok, [presence_error(K)]). + hope_result:t(T, [presence_error(K)]) + when T :: t(K, _V). validate_unique_presence(T, KeysRequired, KeysOptional) -> case find_unique_presence_violations(T, KeysRequired, KeysOptional) of #hope_kv_list_presence_violations @@ -146,7 +148,7 @@ validate_unique_presence(T, KeysRequired, KeysOptional) -> , keys_duplicated = [] , keys_unsupported = [] } -> - {ok, ok} + {ok, T} ; #hope_kv_list_presence_violations{}=Violations -> {error, presence_violations_to_list(Violations)} end.