It was not immediately obvious to me how to construct a correct invocation of mapReduce. Its signature shows it returning an STM (Async a), so it seemed not too far-fetched to try to wait for it in the same STM transaction that created it:
but that fails with the dreaded "thread blocked indefinitely" error. It turns out (after finding an example in one of the tests) that the correct invocation is rather:
With the waitSTM (via wait) in a separate atomic transaction. Some text showing correct usage may also be helpful to others, perhaps with an explanation motivating the need for the separation (but a simple dictate may suffice).
It was not immediately obvious to me how to construct a correct invocation of
mapReduce
. Its signature shows it returning anSTM (Async a)
, so it seemed not too far-fetched to try to wait for it in the same STM transaction that created it:but that fails with the dreaded "thread blocked indefinitely" error. It turns out (after finding an example in one of the tests) that the correct invocation is rather:
With the
waitSTM
(viawait
) in a separate atomic transaction. Some text showing correct usage may also be helpful to others, perhaps with an explanation motivating the need for the separation (but a simple dictate may suffice).