Update interface of Apply
authorwidmogrod <widmogrod@gmail.com>
Sat, 23 Dec 2017 21:10:20 +0000 (22:10 +0100)
committerwidmogrod <widmogrod@gmail.com>
Sat, 23 Dec 2017 21:10:20 +0000 (22:10 +0100)
14 files changed:
src/FantasyLand/Apply.php
src/Monad/Either/Left.php
src/Monad/Either/Right.php
src/Monad/Free/Free.php
src/Monad/Free/Pure.php
src/Monad/IO.php
src/Monad/Identity.php
src/Monad/Maybe/Just.php
src/Monad/Maybe/Nothing.php
src/Monad/Reader.php
src/Monad/State.php
src/Monad/Writer.php
src/Primitive/ListtCons.php
src/Primitive/ListtNil.php

index 3cc88db..a94c4df 100644 (file)
@@ -11,5 +11,5 @@ interface Apply extends Functor
      *
      * @return self
      */
-    public function ap(self $b);
+    public function ap(self $b): self;
 }
index 6122f36..363e604 100644 (file)
@@ -17,7 +17,7 @@ class Left implements Either
     /**
      * @inheritdoc
      */
-    public function ap(FantasyLand\Apply $b)
+    public function ap(FantasyLand\Apply $b): FantasyLand\Apply
     {
         return $this;
     }
index b817ba9..f6deb46 100644 (file)
@@ -17,7 +17,7 @@ class Right implements Either
     /**
      * @inheritdoc
      */
-    public function ap(FantasyLand\Apply $b)
+    public function ap(FantasyLand\Apply $b): FantasyLand\Apply
     {
         return $b->map($this->value);
     }
index 53234ae..f69184d 100644 (file)
@@ -54,7 +54,7 @@ class Free implements MonadFree
      *
      * @inheritdoc
      */
-    public function ap(FantasyLand\Apply $b)
+    public function ap(FantasyLand\Apply $b): FantasyLand\Apply
     {
         return new self(
             $this->f->map(function ($ma) use ($b) {
index 820872e..7ebfd28 100644 (file)
@@ -16,7 +16,7 @@ class Pure implements MonadFree
     /**
      * @inheritdoc
      */
-    public function ap(FantasyLand\Apply $b)
+    public function ap(FantasyLand\Apply $b): FantasyLand\Apply
     {
         return $b->map($this->value);
     }
index 3196a36..43ca21f 100644 (file)
@@ -28,7 +28,7 @@ class IO implements
     /**
      * @inheritdoc
      */
-    public function ap(FantasyLand\Apply $b)
+    public function ap(FantasyLand\Apply $b): FantasyLand\Apply
     {
         return $b->map($this->run());
     }
index deb280c..35cc325 100644 (file)
@@ -27,7 +27,7 @@ class Identity implements
     /**
      * @inheritdoc
      */
-    public function ap(FantasyLand\Apply $applicative)
+    public function ap(FantasyLand\Apply $applicative): FantasyLand\Apply
     {
         return $applicative->map($this->value);
     }
index 530eef9..13f1c3e 100644 (file)
@@ -17,7 +17,7 @@ class Just implements Maybe
     /**
      * @inheritdoc
      */
-    public function ap(FantasyLand\Apply $applicative)
+    public function ap(FantasyLand\Apply $applicative): FantasyLand\Apply
     {
         return $applicative->map($this->value);
     }
index 10cc52a..73a37bf 100644 (file)
@@ -21,7 +21,7 @@ class Nothing implements Maybe
     /**
      * @inheritdoc
      */
-    public function ap(FantasyLand\Apply $applicative)
+    public function ap(FantasyLand\Apply $applicative): FantasyLand\Apply
     {
         return $this;
     }
index 0315761..a423ed1 100644 (file)
@@ -28,7 +28,7 @@ class Reader implements FantasyLand\Monad
         });
     }
 
-    public function ap(FantasyLand\Apply $b)
+    public function ap(FantasyLand\Apply $b): FantasyLand\Apply
     {
         return $this->bind(function ($f) use ($b) {
             return $b->map($f);
index 76a1c2e..1796176 100644 (file)
@@ -24,7 +24,7 @@ class State implements FantasyLand\Monad
     /**
      * @inheritdoc
      */
-    public function ap(FantasyLand\Apply $b)
+    public function ap(FantasyLand\Apply $b): FantasyLand\Apply
     {
         return $this->bind(function ($f) use ($b) {
             return $b->map($f);
index fa3992b..2a3b399 100644 (file)
@@ -39,7 +39,7 @@ class Writer implements FantasyLand\Monad
         return new static($value, $this->side->concat($side));
     }
 
-    public function ap(FantasyLand\Apply $b)
+    public function ap(FantasyLand\Apply $b): FantasyLand\Apply
     {
         return $this->bind(function ($f) use ($b) {
             return $b->map($f);
index 96c6d78..80fbf68 100644 (file)
@@ -56,7 +56,7 @@ class ListtCons implements Listt, \IteratorAggregate
      *
      * fs <*> xs = [f x | f <- fs, x <- xs]
      */
-    public function ap(FantasyLand\Apply $applicative)
+    public function ap(FantasyLand\Apply $applicative): FantasyLand\Apply
     {
         return $this->reduce(function ($accumulator, $value) use ($applicative) {
             /** @var $applicative self */
index 726c7ae..269c4fd 100644 (file)
@@ -30,7 +30,7 @@ class ListtNil implements Listt
      *
      * fs <*> xs = [f x | f <- fs, x <- xs]
      */
-    public function ap(FantasyLand\Apply $applicative)
+    public function ap(FantasyLand\Apply $applicative): FantasyLand\Apply
     {
         return $this;
     }