Implement automatic currying.
[hope.git] / test / hope_fun_SUITE.erl
index d4e2281..910cc49 100644 (file)
@@ -9,6 +9,7 @@
 %% Test cases
 -export(
     [ t_id/1
+    , t_curry/1
     ]).
 
 
@@ -26,6 +27,7 @@ all() ->
 groups() ->
     Tests =
         [ t_id
+        , t_curry
         ],
     Properties = [parallel],
     [ {?GROUP, Properties, Tests}
@@ -39,3 +41,20 @@ groups() ->
 t_id(_Cfg) ->
     X = foo,
     X = hope_fun:id(X).
+
+t_curry(_Cfg) ->
+    Single = fun (X) -> X end,
+    Double = fun (X, Y) -> {X, Y} end,
+    Triple = fun (X, Y, Z) -> {X, Y, Z} end,
+
+    F = hope_fun:curry(Single),
+    a = F(a),
+
+    G1 = hope_fun:curry(Double),
+    G = G1(a),
+    {a, b} = G(b),
+
+    H1 = hope_fun:curry(Triple),
+    H2 = H1(a),
+    H  = H2(b),
+    {a, b, c} = H(c).
This page took 0.021365 seconds and 4 git commands to generate.