function fconst(...$args) { $ret = fmap()->compose(cnst()); if ($args) { $ret = $ret(...$args); } return $ret; }
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); } }
public static function pure($a) { return cnst($a); }