Skip to content

IOSim interferes with QuickCheck exception handling #230

@MaximilianAlgehed

Description

@MaximilianAlgehed

Describe the bug
We observe the following:

ghci> quickCheck $ discardAfter 1 $ runSimOrThrow $ True <$ (forever (threadDelay 10))
*** Failed! Exception: '<<evaluation error: <<timeout>>>>' (after 1 test):

To Reproduce

ghci> import Test.QuickCheck
ghci> import Control.Monad.IOSim
ghci> import Control.Monad.Class.MonadTimer
ghci> quickCheck $ discardAfter 1 $ runSimOrThrow $ True <$ (forever (threadDelay 10))
*** Failed! Exception: '<<evaluation error: <<timeout>>>>' (after 1 test):

Expected behaviour

ghci> quickCheck $ discardAfter 1 $ runSimOrThrow $ True <$ (forever (threadDelay 10))
*** Gave up! Passed only 0 tests; 1000 discarded tests.

Desktop (please complete the following information):

  • GHC version: 9.12.2
  • io-sim version: 1.8.0.1
  • io-classes version: 1.8.0.1

Additional context
I think what's going on here is that io-sim is catching all timeout exceptions even though these are thrown by QuickCheck in this case. Perhaps more care can be taken here to avoid overlapping with QuickCheck? QuickCheck might be able to use a different exception, but that feels like a crutch?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions