示例#1
0
 public function testRun()
 {
     $this->assertEquals(Reader::of(2)->chain(function ($x) {
         return Reader::ask()->map(function ($y) use($x) {
             return $x + $y;
         });
     })->run(20), 22, 'Runs.');
 }
示例#2
0
 public function testAsk()
 {
     $this->assertEquals(Reader::of(2)->chain(function ($x) {
         return Reader::ask()->map(function ($y) use($x) {
             return $x + $y;
         });
     })->run(4), 6, 'Accesses environment.');
 }