for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace loophp\combinator\Combinator;
use Closure;
use loophp\combinator\Combinator;
/**
* Class R.
*
* @psalm-template AType
* @psalm-template BType
* @psalm-template CType
*/
final class R extends Combinator
{
* @var callable
private $f;
* @var mixed
private $x;
private $y;
* R constructor.
* @psalm-param AType $x
* @psalm-param callable(BType): callable(AType): CType $f
* @psalm-param BType $y
* @param mixed $x
* @param callable $f
* @param mixed $y
public function __construct($x, callable $f, $y)
$this->f = $f;
$this->y = $y;
$this->x = $x;
}
* @psalm-return CType
public function __invoke()
return (($this->f)($this->y))($this->x);
* @param callable $a
* @return Closure
public static function on($a): Closure
return static function (callable $b) use ($a): Closure {
return static function ($c) use ($a, $b) {
return (new self($a, $b, $c))();
};