@@ -3,10 +3,10 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | |
| 6 | -P::macro('lens', function (callable $getter, callable $setter) { |
|
| 7 | - return P::curryN(2, function (callable $toFunctorFn, $target) use ($getter, $setter) { |
|
| 6 | +P::macro('lens', function(callable $getter, callable $setter) { |
|
| 7 | + return P::curryN(2, function(callable $toFunctorFn, $target) use ($getter, $setter) { |
|
| 8 | 8 | return P::map( |
| 9 | - function ($focus) use ($target, $setter) { |
|
| 9 | + function($focus) use ($target, $setter) { |
|
| 10 | 10 | return $setter($focus, $target); |
| 11 | 11 | }, |
| 12 | 12 | $toFunctorFn($getter($target)) |
@@ -4,9 +4,9 @@ |
||
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | use Baethon\Phln\Monad\Constant; |
| 6 | 6 | |
| 7 | -P::macro('view', function (callable $lens, $targetData) { |
|
| 7 | +P::macro('view', function(callable $lens, $targetData) { |
|
| 8 | 8 | return $lens( |
| 9 | - function ($value) { |
|
| 9 | + function($value) { |
|
| 10 | 10 | return new Constant($value); |
| 11 | 11 | }, |
| 12 | 12 | $targetData |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | use function Baethon\Phln\assert_object; |
| 6 | 6 | |
| 7 | -P::macro('has', function (string $prop, $object) { |
|
| 7 | +P::macro('has', function(string $prop, $object) { |
|
| 8 | 8 | assert_object($object); |
| 9 | 9 | |
| 10 | 10 | return is_object($object) |
@@ -3,6 +3,6 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | |
| 6 | -P::macro('set', function (callable $lens, $value, $targetData) { |
|
| 6 | +P::macro('set', function(callable $lens, $value, $targetData) { |
|
| 7 | 7 | return P::over($lens, P::always($value), $targetData); |
| 8 | 8 | }); |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | |
| 6 | -P::macro('lensPath', function (string $path) { |
|
| 6 | +P::macro('lensPath', function(string $path) { |
|
| 7 | 7 | return P::lens( |
| 8 | 8 | P::path($path), |
| 9 | 9 | P::assocPath($path) |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | |
| 6 | -P::macro('lensProp', function (string $prop) { |
|
| 6 | +P::macro('lensProp', function(string $prop) { |
|
| 7 | 7 | return P::lens( |
| 8 | 8 | P::prop($prop), |
| 9 | 9 | P::assoc($prop) |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | use function Baethon\Phln\assert_object; |
| 6 | 6 | |
| 7 | -P::macro('assoc', function (string $key, $value, $object) { |
|
| 7 | +P::macro('assoc', function(string $key, $value, $object) { |
|
| 8 | 8 | assert_object($object); |
| 9 | 9 | |
| 10 | 10 | if (is_object($object)) { |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | use function Baethon\Phln\assert_object; |
| 6 | 6 | |
| 7 | -$clone = function ($object) { |
|
| 7 | +$clone = function($object) { |
|
| 8 | 8 | return is_object($object) |
| 9 | 9 | ? clone $object |
| 10 | 10 | : $object; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | return $anchor[$key]; |
| 25 | 25 | }; |
| 26 | 26 | |
| 27 | -P::macro('assocPath', function (string $path, $value, $object) use ($clone, $assoc) { |
|
| 27 | +P::macro('assocPath', function(string $path, $value, $object) use ($clone, $assoc) { |
|
| 28 | 28 | assert_object($object); |
| 29 | 29 | |
| 30 | 30 | $keys = P::split('.', $path); |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | $lastProp = P::last($keys); |
| 38 | 38 | |
| 39 | 39 | $copy = $clone($object); |
| 40 | - $anchor =& $copy; |
|
| 40 | + $anchor = & $copy; |
|
| 41 | 41 | |
| 42 | 42 | foreach ($anchorPath as $k) { |
| 43 | 43 | $node = P::has($k, $anchor) |
| 44 | 44 | ? $clone(P::prop($k, $anchor)) |
| 45 | 45 | : []; |
| 46 | 46 | |
| 47 | - $anchor =& $assoc($k, $node, $anchor); |
|
| 47 | + $anchor = & $assoc($k, $node, $anchor); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $assoc($lastProp, $value, $anchor); |
@@ -4,9 +4,9 @@ |
||
| 4 | 4 | use Baethon\Phln\Phln as P; |
| 5 | 5 | use Baethon\Phln\Monad\Identity; |
| 6 | 6 | |
| 7 | -P::macro('over', function (callable $lens, callable $fn, $targetData) { |
|
| 7 | +P::macro('over', function(callable $lens, callable $fn, $targetData) { |
|
| 8 | 8 | return $lens( |
| 9 | - function ($value) use ($fn) { |
|
| 9 | + function($value) use ($fn) { |
|
| 10 | 10 | return Identity::of($fn($value)); |
| 11 | 11 | }, |
| 12 | 12 | $targetData |