Closed sdzx-1 closed 1 year ago
Describe the bug
The implementation of Control.Monad.IOSim.STM.isEmptyTBQueueDefault is wrong.
Control.Monad.IOSim.STM.isEmptyTBQueueDefault
https://github.com/input-output-hk/io-sim/blob/0df93fe773e9b66ce35f3637128533e5b0029558/io-sim/src/Control/Monad/IOSim/STM.hs#L172
Additional context
-- wrong isEmptyTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m Bool isEmptyTBQueueDefault (TBQueue queue _size) = do (xs, _, _, _) <- readTVar queue case xs of _:_ -> return False [] -> return True ---------------------------------------- -- right isEmptyTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m Bool isEmptyTBQueueDefault (TBQueue queue _size) = do (xs, _, ys, _) <- readTVar queue case xs of (_:_) -> return False [] -> case ys of [] -> return True _ -> return False
pr: https://github.com/input-output-hk/io-sim/pull/44 @coot
Good catch, thanks for your PR as well.
Describe the bug
The implementation of
Control.Monad.IOSim.STM.isEmptyTBQueueDefault
is wrong.https://github.com/input-output-hk/io-sim/blob/0df93fe773e9b66ce35f3637128533e5b0029558/io-sim/src/Control/Monad/IOSim/STM.hs#L172
Additional context
pr: https://github.com/input-output-hk/io-sim/pull/44 @coot