コード例 #1
0
ファイル: IdentityTest.php プロジェクト: bugadani/monad
 public function testIdentityChained()
 {
     $result = Identity::unit(1)->bind(function ($value) {
         return 2 * $value;
     })->bind(function ($value) {
         return $value + 1;
     });
     $this->assertEquals(3, $result->extract());
     $this->assertEquals('Identity(3)', (string) $result);
 }