Skip to content

Commit

Permalink
Fix 'bhead is not a function' for forks (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
natefaubion committed Apr 18, 2018
1 parent 34a038b commit 3457df9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Control/Monad/Aff.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,15 @@ var Aff = function () {
break;

case FORK:
status = STEP_BIND;
status = STEP_RESULT;
tmp = Fiber(util, supervisor, step._2);
if (supervisor) {
supervisor.register(tmp);
}
if (step._1) {
tmp.run();
}
step = tmp;
step = util.right(tmp);
break;

case SEQ:
Expand Down
10 changes: 9 additions & 1 deletion test/Test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ test_scheduler_size = assert "scheduler" do
eq 100000 <$> readRef ref

test_lazy eff. TestAff eff Unit
test_lazy = assert "Lazy Aff" do
test_lazy = assert "lazy" do
varA ← makeEmptyVar
varB ← makeEmptyVar
fiberA <- forkAff $ fix \loop -> do
Expand All @@ -653,6 +653,13 @@ test_lazy = assert "Lazy Aff" do
putVar 0 varA
eq "done" <$> joinFiber fiberB

test_regression_return_fork eff. TestAff eff Unit
test_regression_return_fork = assert "regression/return-fork" do
bracket
(forkAff (pure unit))
(const (pure unit))
(const (pure true))

main TestEff () Unit
main = do
test_pure
Expand Down Expand Up @@ -698,3 +705,4 @@ main = do
-- Turn on if we decide to schedule forks
-- test_scheduler_size
test_parallel_stack
test_regression_return_fork

0 comments on commit 3457df9

Please sign in to comment.