It's reporting that every module is unused, which isn't true. The
weeder README says this is still the correct way to do things, so I'm
not sure what's going on.
dejafu needs a few things which can't be implemented purely:
- mutable references
- bound threads
Mutable references used to come from the MonadRef class, but with the
introduction of bound threads in 1.0.0.0, it seemed easiest to use a
MonadConc as the underlying monad. This also allowed simplifying the
API a lot, and was generally a good move.
But it lost purity. By *requiring* bound threads be supported by the
base monad, ST was out.
Making bound threads optional (by moving rtsSupportsBoundThreads into
MonadConc and introducing an additional layer of abstraction in
dejafu) makes it possible to recover purity. Pure implementations
just won't support bound threads.
From Control.Exception:
> Note that if `throwTo` is called with the current thread as the
> target, the exception will be thrown even if the thread is currently
> inside `mask` or `uninterruptibleMask`.
It's wrong to use initialDepState when there is a setup action, as the
action could end with a DepState which is not the same as the initial
one. Here's an example of it going wrong:
> :{
resultsSet defaultWay defaultMemType $ do
v <- newMVar ()
fork (takeMVar v)
readMVar v
:}
fromList [Left Deadlock,Right ()]
> :{
resultsSet defaultWay defaultMemType $
withSetup (newMVar ()) $ \v -> do
fork (takeMVar v)
readMVar v
:}
fromList [Right ()]
This PR pushes responsibility for the DepState into the Context, and
the DepState is passed to all schedulers. That means it's been
promoted from an internal type to a user-facing one, so I gave it the
more generic name "ConcurrencyState". Furthermore, the snapshotted
DepState is passed to all the DPOR functions, and the trace
simplification functions.
initialDepState is now only used:
- in Conc.Internal to initialise a new context
- in SCT.Internal when there is no snapshot