예제 #1
0
 public function testFmap()
 {
     $identity = Identity::unit(1)->fmap(function ($val) {
         return $val * 2;
     })->fmap(function ($val) {
         return $val * 2;
     });
     $this->assertInstanceOf("Monadic\\Type\\Identity", $identity);
     $this->assertEquals(4, $identity->get());
 }
예제 #2
0
 public function fmap($callable)
 {
     return Identity::unit($callable($this->value));
 }