public function provideFunctorTestData() { return ['Right' => ['$f' => function ($x) { return $x + 1; }, '$g' => function ($x) { return $x + 5; }, '$x' => Right::of(1)], 'Left' => ['$f' => function ($x) { return $x + 1; }, '$g' => function ($x) { return $x + 5; }, '$x' => Left::of(1)]]; }
/** * right :: a -> Right a * * @param mixed $value * * @return Right */ function right($value) { return Right::of($value); }
function read($file) { return is_file($file) ? Either\Right::of(file_get_contents($file)) : Either\Left::of(sprintf('File "%s" does not exists', $file)); }
function validateInput(array $request) { return E\Right::of($request)->bind('validateName')->bind('validateEmail')->bind('validateNameLength'); }