The timeout function in System.Timeout sometimes fails to halt an infinite computation.
For example,
timeout 1000 $ print $ length [0..]
returns Nothing
as expected because the timeout interrupts the infinite computation. But
timeout 1000 $ print $ length $ cycle [1,2,3]
loops forever.
This is on a Mac, using ghc or ghci 8.6.4.
I expect the second example to behave like the first, interrupting the infinite computation after 1 millisecond and returning Nothing
. Instead, the second example hangs.