19declare(strict_types=1);
40 return $this->
from(
static fn($value):
Result => $transformation->
applyTo(
new Ok($value))->map(
41 static fn($value): array => [$value]
61 public function as(
string $key, Closure $parse): Closure
75 if (is_array($value) && count($value) === 1 && isset($value[0])) {
82 private function from(Closure $transform, Closure $parse): Closure
88 $child->transform($transform)
89 ->
then($this->combine($previous, $child, $cc))
90 ->except($this->error($cc))
91 )->except($this->error($cc))
97 return static fn(array $values):
Result => $cc(
new Ok(
104 private function error(Closure $cc): Closure
A result encapsulates a value or an error and simplifies the handling of those.
A result encapsulates a value or an error and simplifies the handling of those.
then(callable $f)
Get a new result from the callable or do nothing if this is an error.