summaryrefslogtreecommitdiff
path: root/src/misc.erl
diff options
context:
space:
mode:
authorEvgeny Khramtsov <ekhramtsov@process-one.net>2019-06-27 15:22:27 +0300
committerEvgeny Khramtsov <ekhramtsov@process-one.net>2019-06-27 15:22:27 +0300
commit39cf8d86d62defcbeba5e6935c8b19ee3df1dd76 (patch)
tree0db2a22a394752d0532afc1fff5a988947326513 /src/misc.erl
parentUse correct rr_type() (diff)
Avoid using broad map() type wherever possible
Diffstat (limited to 'src/misc.erl')
-rw-r--r--src/misc.erl4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/misc.erl b/src/misc.erl
index 16e4122b..3aacd3a6 100644
--- a/src/misc.erl
+++ b/src/misc.erl
@@ -51,6 +51,8 @@
-include("xmpp.hrl").
-include_lib("kernel/include/file.hrl").
+-type distance_cache() :: #{{string(), string()} => non_neg_integer()}.
+
%%%===================================================================
%%% API
%%%===================================================================
@@ -598,7 +600,7 @@ unique_timestamp() ->
{MS, S, erlang:unique_integer([positive, monotonic]) rem 1000000}.
%% Levenshtein distance
--spec ld(string(), string(), map()) -> {non_neg_integer(), map()}.
+-spec ld(string(), string(), distance_cache()) -> {non_neg_integer(), distance_cache()}.
ld([] = S, T, Cache) ->
{length(T), maps:put({S, T}, length(T), Cache)};
ld(S, [] = T, Cache) ->