Closed agocorona closed 4 years ago
However if instead of error "a"
I use throwt $ ErrorCall "a"
it works well.
error "a"= throw $ ErrorCall "a"
However without exceptions the problem is the same:
main= keep' $ do
x <- threads 0 $ choose [1..3 :: Int]
liftIO $ print x
when (x== 1) $ error "error"
return ()
1 keep': error ...
Solved. pending upload together with other changes
This program creates three tasks under the original thread (since
threads 0
precludes the creation of new threads forchoose
). It uses the backtracking promitives:It produces: 0 -- generated by
return 0
1 -- due toonBack
andchoose
2 -- due toonBack
andchoose
3 -- due toonBack
andchoose
Now, the same/equivalent program using exceptions only produces two results:
0
1
It seems that the first time that empty is executed, after
choose 1
has been executed, which triggers "b" exception, stop the whole computation. It shouldn't, since exceptions are managed by the same mechanism.