From: Siraaj Khandkar Date: Mon, 23 May 2016 18:10:26 +0000 (-0400) Subject: Ignore outputs of side-effecting, element-handler functions. X-Git-Tag: 3.9.0^0 X-Git-Url: https://git.xandkar.net/?p=hope.git;a=commitdiff_plain;h=0ed4baebe135edc50d24d3613c6ee971f75d8c98 Ignore outputs of side-effecting, element-handler functions. --- diff --git a/src/hope.app.src b/src/hope.app.src index a399d58..d36cc38 100644 --- a/src/hope.app.src +++ b/src/hope.app.src @@ -1,7 +1,7 @@ {application, hope, [ {description, "Higher Order Programming in Erlang"}, - {vsn, "3.8.1"}, + {vsn, "3.9.0"}, {registered, []}, {applications, [ kernel, diff --git a/src/hope_gen_dictionary.erl b/src/hope_gen_dictionary.erl index ea0f551..174ef67 100644 --- a/src/hope_gen_dictionary.erl +++ b/src/hope_gen_dictionary.erl @@ -39,7 +39,7 @@ -callback fold(t(K, V), fun((K, V, Acc) -> Acc), Acc) -> Acc. --callback iter(t(K, V), fun((K, V) -> ok)) -> +-callback iter(t(K, V), fun((K, V) -> any())) -> ok. %% TODO: Decide if validation is to be done. If yes - wrap in hope_result:t/1 diff --git a/src/hope_kv_list.erl b/src/hope_kv_list.erl index c12f3b4..44a78d4 100644 --- a/src/hope_kv_list.erl +++ b/src/hope_kv_list.erl @@ -105,7 +105,7 @@ pop(T1, K) -> ; false -> {none , T1} end. --spec iter(t(K, V), fun((K, V) -> ok)) -> +-spec iter(t(K, V), fun((K, V) -> any())) -> ok. iter(T, F1) -> F2 = lift_map(F1), diff --git a/src/hope_option.erl b/src/hope_option.erl index 996e342..c645c53 100644 --- a/src/hope_option.erl +++ b/src/hope_option.erl @@ -57,10 +57,13 @@ return(X, Condition) -> map({some, X}, F) -> {some, F(X)}; map(none , _) -> none. --spec iter(t(A), fun((A) -> (ok))) -> +-spec iter(t(A), fun((A) -> (any()))) -> + ok. +iter({some, X}, F) -> + _ = F(X), + ok; +iter(none, _) -> ok. -iter({some, X}, F) -> ok = F(X); -iter(none , _) -> ok. -spec pipe([fun((A) -> t(B))], A) -> t(B).