From 0ed4baebe135edc50d24d3613c6ee971f75d8c98 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Mon, 23 May 2016 14:10:26 -0400 Subject: [PATCH] Ignore outputs of side-effecting, element-handler functions. --- src/hope.app.src | 2 +- src/hope_gen_dictionary.erl | 2 +- src/hope_kv_list.erl | 2 +- src/hope_option.erl | 9 ++++++--- 4 files changed, 9 insertions(+), 6 deletions(-) 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). -- 2.20.1