예제 #1
0
function fconst(...$args)
{
    $ret = fmap()->compose(cnst());
    if ($args) {
        $ret = $ret(...$args);
    }
    return $ret;
}
예제 #2
0
function const1(...$args)
{
    $f = function ($a, $b) {
        return ap(fmap(cnst(), $a), $b);
    };
    if (count($args) === 2) {
        return $f(...$args);
    } else {
        return f($f, ...$args);
    }
}
예제 #3
0
 public static function pure($a)
 {
     return cnst($a);
 }