Firstly, concurrency
's link
doesn’t have the desirable behaviour. It’s nothing to do with the choice of ThreadKilled
versus AsyncException
It has very much to do with it. How else would you implement a proper link
that propagates exceptions to the parent thread yet allows the linked Async
to be cancelled.
My mistake was to link to concurrently
instead of cancel
which made my ThreadKilled
point less clear (more on why I originally linked to concurrencly
below).
Secondly, if you killThread
(via asyncThreadId
) an async
-link
ed thread, the ThreadKilled
will be thrown to you when the linked thread terminates. That’s bad!
No, that the whole point of link
– propagate exceptions to the main thread.
Even without asyncThreadId
there was a design gap (I would rather call it a bug) when it was impossible to cancel
the linked thread.
The stock library, actively used and maintained, got a bug fix. Stale concurrency
didn’t.
If you compare both concurrently
versions I linked above you could find that not only they throwTo
different exceptions, but that the stock version has much more code which handles corner cases not handled in the stale concurrency
.
So my objections:
- The verification library does not have bugfixes which defeats its purpose.
- It also has a different behavior which breaks programs written for stock libraries. The very programs it supposed to verify.
- Due to the above, experience with stock Haskell libraries doesn’t transfer to the world of
concurrency
leading to bugs and frustration for new developers.
- Stale
MonadConc
primitives do not match stock implementation primitives leading to even subtler differences.
- Mixing concurrency and a monad transformer can lead to extremely convoluted and unexpected execution traces.
In general, concurrency
is definitely a good topic for PhD, might be good to temporarily run some code with it and check for possible bugs. But I would be very wary of running a production system on it.
If it was actively maintained and faithfully updated to match the standard library then it might be ok. But it’s stale, so I suggest to use standard libraries and keep concurrenct code simple enough to be model checked in one’s head (helps with maintenance too).