Skip to content

Commit

Permalink
Fix lval/rval
Browse files Browse the repository at this point in the history
  • Loading branch information
lmnt-dev committed Aug 22, 2020
1 parent 5ccb99f commit 751a1f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/philo.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function create($T, $x, $k = null, $strict = false)
} else {
/** @var bool|Left|Right $v */
$v = f($T)($x, $k);
return is_left($v) ? left($x) : right($x);
return is_left($v) ? left($v) : right($x);
}
return right($x);
}
Expand Down Expand Up @@ -169,7 +169,7 @@ function __construct($x)
*/
function left($x)
{
return new Left($x);
return $x instanceof Left ? $x : new Left($x);
}

/**
Expand All @@ -178,7 +178,7 @@ function left($x)
*/
function right($x)
{
return new Right($x);
return $x instanceof Right ? $x : new Right($x);
}

/**
Expand All @@ -196,7 +196,7 @@ function lval($x)
return lval($x->value);
}
if ($x instanceof Right) {
return is_array($x->value) ? array_map(fn () => null, $x->value ?? $x) : null;
return is_array($x->value) ? array_map(fn () => null, $x->value) : null;
}
return $x;
}
Expand Down

0 comments on commit 751a1f2

Please sign in to comment.