[Haskell-cafe] System.Timeout problems

Neil Mitchell ndmitchell at gmail.com
Sat May 26 20:32:40 EDT 2007


Hi

I'm using the System.Timeout module from base, copied into my local
repo, so that I can work with GHC 6.6.1. My copy is at:
http://www.cs.york.ac.uk/fp/darcs/catch/catch_1/System/TimeoutGHC.hs
(but it is identical to the one in base)

Sadly, it doesn't seem to work for me. Here are the tests I've been
using, the results I get, and what I would have liked. All are GHC 6.6
on Windows.

-- TEST 1
import System.TimeoutGHC

main :: IO ()
main = do
    r <- timeout (5 * 10^6) (putStrLn "here")
    print r

Without -threaded:
here >> Just () >> wait 5 seconds

Without -threaded:
here >> wait 5 seconds >> Just ()

So, either way, I get a 5 second delay - not something I want.

-- TEST 2
import System.TimeoutGHC

main :: IO ()
main = do
    r <- timeout (length [1..]) (putStrLn "here")
    print r

Now, with either -threaded, or without, it never terminates.

Basically I can't get the timeout to do anything I would like with any
flags. Can someone come to my rescue? Am I getting timeout wrong?

Thanks

Neil


More information about the Haskell-Cafe mailing list