@@ -6,16 +6,16 @@ |
||
6 | 6 | |
7 | 7 | load_macro('relation', 'max'); |
8 | 8 | |
9 | -P::macro('allPass', call_user_func(function () { |
|
9 | +P::macro('allPass', call_user_func(function() { |
|
10 | 10 | $getArity = P::pipe([ |
11 | 11 | P::map(P::raw('arity')), |
12 | 12 | P::reduce(P::max(), 0), |
13 | 13 | ]); |
14 | 14 | |
15 | - return function (array $predicates) use ($getArity): callable { |
|
16 | - return P::curryN($getArity($predicates), function (...$values) use ($predicates) { |
|
15 | + return function(array $predicates) use ($getArity): callable { |
|
16 | + return P::curryN($getArity($predicates), function(...$values) use ($predicates) { |
|
17 | 17 | return P::reduce( |
18 | - function ($carry, callable $p) use ($values) { |
|
18 | + function($carry, callable $p) use ($values) { |
|
19 | 19 | return (false === $carry) ? false : $p(...$values); |
20 | 20 | }, |
21 | 21 | true, |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | load_macro('type', 'is'); |
8 | 8 | load_macro('logic', 'cond'); |
9 | 9 | |
10 | -P::macro('both', call_user_func(function () { |
|
10 | +P::macro('both', call_user_func(function() { |
|
11 | 11 | $allPrimitives = P::unapply(P::all(P::is('bool'))); |
12 | 12 | $allCallables = P::unapply(P::all(P::is('callable'))); |
13 | 13 | |
14 | - $bothPredicate = function ($left, $right) { |
|
15 | - return function (...$args) use ($left, $right) { |
|
14 | + $bothPredicate = function($left, $right) { |
|
15 | + return function(...$args) use ($left, $right) { |
|
16 | 16 | return $left(...$args) && $right(...$args); |
17 | 17 | }; |
18 | 18 | }; |
19 | 19 | |
20 | - $compareBooleans = function ($left, $right) { |
|
20 | + $compareBooleans = function($left, $right) { |
|
21 | 21 | return $left && $right; |
22 | 22 | }; |
23 | 23 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | [P::otherwise(), P::throwException(\InvalidArgumentException::class, [])], |
28 | 28 | ]); |
29 | 29 | |
30 | - return function ($left, $right) use ($both) { |
|
30 | + return function($left, $right) use ($both) { |
|
31 | 31 | return $both($left, $right); |
32 | 32 | }; |
33 | 33 | })); |
@@ -6,16 +6,16 @@ discard block |
||
6 | 6 | |
7 | 7 | load_macro('type', 'is'); |
8 | 8 | |
9 | -P::macro('either', call_user_func(function () { |
|
9 | +P::macro('either', call_user_func(function() { |
|
10 | 10 | $allPrimitives = P::unapply(P::all(P::is('bool'))); |
11 | 11 | $allCallables = P::unapply(P::all(P::is('callable'))); |
12 | 12 | |
13 | - $compareBooleans = function ($left, $right) { |
|
13 | + $compareBooleans = function($left, $right) { |
|
14 | 14 | return $left || $right; |
15 | 15 | }; |
16 | 16 | |
17 | - $eitherPredicate = function ($left, $right) { |
|
18 | - return function (...$args) use ($left, $right) { |
|
17 | + $eitherPredicate = function($left, $right) { |
|
18 | + return function(...$args) use ($left, $right) { |
|
19 | 19 | return $left(...$args) || $right(...$args); |
20 | 20 | }; |
21 | 21 | }; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | [P::otherwise(), P::throwException(\InvalidArgumentException::class, [])], |
27 | 27 | ]); |
28 | 28 | |
29 | - return function ($left, $right) use ($either) { |
|
29 | + return function($left, $right) use ($either) { |
|
30 | 30 | return $either($left, $right); |
31 | 31 | }; |
32 | 32 | })); |
@@ -3,8 +3,8 @@ |
||
3 | 3 | |
4 | 4 | use Baethon\Phln\Phln as P; |
5 | 5 | |
6 | -P::macro('cond', function (array $pairs): \Closure { |
|
7 | - return function (... $args) use ($pairs) { |
|
6 | +P::macro('cond', function(array $pairs): \Closure { |
|
7 | + return function(... $args) use ($pairs) { |
|
8 | 8 | $callPredicate = P::partialRight(P::apply(), [$args]); |
9 | 9 | $pairMatchingArgs = P::compose([$callPredicate, P::nth(0)]); |
10 | 10 | $getTransformer = P::pipe([ |
@@ -8,7 +8,7 @@ |
||
8 | 8 | load_macro('collection', 'reduce'); |
9 | 9 | |
10 | 10 | P::macro('collapse', P::reduce( |
11 | - function ($carry, $item) { |
|
11 | + function($carry, $item) { |
|
12 | 12 | return is_array($item) |
13 | 13 | ? array_merge($carry, $item) |
14 | 14 | : P::append($item, $carry); |
@@ -9,9 +9,9 @@ |
||
9 | 9 | load_macro('relation', 'equals'); |
10 | 10 | load_macro('fn', ['T', 'unapply', 'compose', 'throwException']); |
11 | 11 | |
12 | -P::macro('concat', call_user_func(function () { |
|
12 | +P::macro('concat', call_user_func(function() { |
|
13 | 13 | $argsToTypes = P::unapply(P::map('\\gettype')); |
14 | - $matchesType = function (string $type) use ($argsToTypes) { |
|
14 | + $matchesType = function(string $type) use ($argsToTypes) { |
|
15 | 15 | return P::compose([P::equals([$type, $type]), $argsToTypes]); |
16 | 16 | }; |
17 | 17 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | load_macro('collection', 'reduce'); |
8 | 8 | |
9 | 9 | P::macro('fromPairs', P::reduce( |
10 | - function ($carry, $item) { |
|
10 | + function($carry, $item) { |
|
11 | 11 | list ($key, $value) = $item; |
12 | 12 | |
13 | 13 | return array_merge($carry, [$key => $value]); |
@@ -10,7 +10,7 @@ |
||
10 | 10 | load_macro('type', ['typeCond', 'is']); |
11 | 11 | load_macro('collection', ['slice', 'length', 'nth']); |
12 | 12 | |
13 | -P::macro('head', call_user_func(function () { |
|
13 | +P::macro('head', call_user_func(function() { |
|
14 | 14 | $sliceFirst = P::slice(0, 1); |
15 | 15 | $moreThanZero = P::compose([P::lte(1), P::length()]); |
16 | 16 | $headOfArray = P::cond([ |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | load_macro('logic', 'isEmpty'); |
8 | 8 | |
9 | -P::macro('last', call_user_func(function () { |
|
9 | +P::macro('last', call_user_func(function() { |
|
10 | 10 | $lastElement = P::slice(-1, 1); |
11 | 11 | $lastOfArray = P::pipe([ |
12 | 12 | $lastElement, |