Exemple #1
0
 public function testMap()
 {
     $addTwo = function ($x) {
         return $x + 2;
     };
     $id = function ($x) {
         return $x;
     };
     $a = new Right(5);
     $b = new Left(4);
     $this->assertEquals($a->map($addTwo)->either($id, $id), 7, 'Maps a Right.');
     $this->assertEquals($b->map($addTwo)->either($id, $id), 4, 'Maps a Left.');
 }