Inheritance: extends Widmogrod\FantasyLand\Functor
コード例 #1
0
ファイル: Listt.php プロジェクト: widmogrod/php-functional
 /**
  * @inheritdoc
  *
  * fs <*> xs = [f x | f <- fs, x <- xs]
  */
 public function ap(FantasyLand\Apply $applicative)
 {
     return $this->reduce(function ($accumulator, $value) use($applicative) {
         /** @var $applicative self */
         return f\concatM($accumulator, $applicative->map($value));
     }, self::mempty());
 }
コード例 #2
0
ファイル: Just.php プロジェクト: widmogrod/php-functional
 /**
  * @inheritdoc
  */
 public function ap(FantasyLand\Apply $applicative)
 {
     return $applicative->map($this->value);
 }
コード例 #3
0
ファイル: Right.php プロジェクト: widmogrod/php-functional
 /**
  * @inheritdoc
  */
 public function ap(FantasyLand\Apply $b)
 {
     return $b->map($this->value);
 }
コード例 #4
0
ファイル: Reader.php プロジェクト: widmogrod/php-functional
 public function ap(FantasyLand\Apply $b)
 {
     return $this->bind(function ($f) use($b) {
         return $b->map($f);
     });
 }
コード例 #5
0
ファイル: State.php プロジェクト: widmogrod/php-functional
 /**
  * @inheritdoc
  */
 public function ap(Apply $b)
 {
     return $this->bind(function ($f) use($b) {
         return $b->map($f);
     });
 }