Use empty tuple as unit type, for all side-effects. 4.0.0
authorSiraaj Khandkar <siraaj@khandkar.net>
Mon, 23 May 2016 18:22:58 +0000 (14:22 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Mon, 23 May 2016 18:22:58 +0000 (14:22 -0400)
src/hope.app.src
src/hope_gen_dictionary.erl
src/hope_kv_list.erl
src/hope_option.erl
test/hope_option_SUITE.erl

index d36cc38..16745b5 100644 (file)
@@ -1,7 +1,7 @@
 {application, hope,
  [
   {description, "Higher Order Programming in Erlang"},
-  {vsn, "3.9.0"},
+  {vsn, "4.0.0"},
   {registered, []},
   {applications, [
                   kernel,
index 174ef67..c0b7e53 100644 (file)
@@ -40,7 +40,7 @@
     Acc.
 
 -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
 -callback of_kv_list([{K, V}]) ->
index 44a78d4..6e3442d 100644 (file)
@@ -106,10 +106,11 @@ pop(T1, K) ->
     end.
 
 -spec iter(t(K, V), fun((K, V) -> any())) ->
-    ok.
+    {}.
 iter(T, F1) ->
     F2 = lift_map(F1),
-    lists:foreach(F2, T).
+    ok = lists:foreach(F2, T),
+    {}.
 
 -spec map(t(K, V), fun((K, V) -> V)) ->
     t(K, V).
index c645c53..29836f7 100644 (file)
@@ -58,12 +58,12 @@ map({some, X}, F) -> {some, F(X)};
 map(none     , _) -> none.
 
 -spec iter(t(A), fun((A) -> (any()))) ->
-    ok.
+    {}.
 iter({some, X}, F) ->
     _ = F(X),
-    ok;
+    {};
 iter(none, _) ->
-    ok.
+    {}.
 
 -spec pipe([fun((A) -> t(B))], A) ->
     t(B).
index af1e12e..d2a73a3 100644 (file)
@@ -66,12 +66,12 @@ t_map(_Cfg) ->
 
 t_iter(_Cfg) ->
     Key = key,
-    Put = fun (Val) -> _ = put(Key, Val), ok end,
+    Put = fun (Val) -> put(Key, Val) end,
     Get = fun () -> get(Key) end,
     Val = foo,
-    ok = hope_option:iter(none       , Put),
+    {} = hope_option:iter(none       , Put),
     undefined = Get(),
-    ok = hope_option:iter({some, Val}, Put),
+    {} = hope_option:iter({some, Val}, Put),
     Val = Get().
 
 t_of_result(_Cfg) ->
This page took 0.033019 seconds and 4 git commands to generate.