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()); }
public function fmap($callable) { return Identity::unit($callable($this->value)); }