Exemple #1
0
 public function testBimap()
 {
     $addOne = function ($x) {
         return $x + 1;
     };
     $takeOne = function ($x) {
         return $x - 1;
     };
     $id = function ($x) {
         return $x;
     };
     $a = new Right(2);
     $b = new Left(2);
     $this->assertEquals($a->bimap($addOne, $takeOne)->either($id, $id), 1, 'Bimaps a Right.');
     $this->assertEquals($b->bimap($addOne, $takeOne)->either($id, $id), 3, 'Bimaps a Left.');
 }