Пример #1
0
 /**
  * @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
 /**
  * @inheritdoc
  */
 public function ap(FantasyLand\Apply $applicative)
 {
     return $applicative->map($this->value);
 }
Пример #3
0
 /**
  * @inheritdoc
  */
 public function ap(FantasyLand\Apply $b)
 {
     return $b->map($this->value);
 }
Пример #4
0
 public function ap(FantasyLand\Apply $b)
 {
     return $this->bind(function ($f) use($b) {
         return $b->map($f);
     });
 }
Пример #5
0
 /**
  * @inheritdoc
  */
 public function ap(Apply $b)
 {
     return $this->bind(function ($f) use($b) {
         return $b->map($f);
     });
 }