示例#1
0
 private function opsFold($ret)
 {
     foreach ($this->ops as $op) {
         list($method, $any) = $op;
         if ($method === self::FMAP) {
             $ret = fmap($any, $ret);
         } else {
             $ret = Loader::callFunction($method, $ret, $any->cast($ret));
         }
     }
     return $ret;
 }
示例#2
0
 public function __call($name, $args)
 {
     $methods = ['ret', 'mempty', 'mzero', 'pure'];
     // $self = $this;
     // if ($self instanceof Any &&
     //     isset($args[0]) &&
     //     !($args[0] instanceof Any))
     //     $self = $self->cast($args[0]);
     // else if (isset($args[0]) &&
     //          $args[0] instanceof Any &&
     //          !($self instanceof Any))
     //     $args[0] = $args[0]->cast($self);
     if (in_array($name, $methods)) {
         return Loader::callFunction($name, ...$args);
     }
     array_unshift($args, $this);
     return Loader::callFunction($name, ...$args);
 }