Skip to content

Commit 6afaff5

Browse files
committed
Clean up interpretation code
1 parent 97ecdd3 commit 6afaff5

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

example/FreeDooDSLTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function test_example_without_do_notation()
3838
return Identity::of($c * $c);
3939
});
4040
});
41-
4241
});
4342

4443
$this->assertEquals(Identity::of(16), $result);

src/Monad/Control/Doo/interpretation.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function interpretation(DooF $f)
3535
return match([
3636
Let::class => function (string $name, Monad $m, MonadFree $next): Reader {
3737
return Reader::of(function (Registry $registry) use ($name, $m, $next) {
38-
return $m->bind(function ($v) use ($name, $next, &$registry) {
38+
return $m->bind(function ($v) use ($name, $next, $registry) {
3939
$registry->set($name, $v);
4040

4141
return $next;
@@ -44,9 +44,7 @@ function interpretation(DooF $f)
4444
},
4545
In::class => function (array $names, callable $fn, callable $next): Reader {
4646
return Reader::of(function (Registry $registry) use ($names, $fn, $next) {
47-
$args = array_map(function ($name) use ($registry) {
48-
return $registry->get($name);
49-
}, $names);
47+
$args = array_map([$registry, 'get'], $names);
5048

5149
return $next($fn(...$args));
5250
});

0 commit comments

Comments
 (0)