[Haskell-cafe] Timeouts that don't cause data growth.

Roel van Dijk vandijk.roel at gmail.com
Tue Mar 23 14:31:01 EDT 2010


I tried a few things. First I added another timeout to main, so the
program kills itself after a few seconds.

doit :: IO (Maybe ())
doit = timeout 12000000 $ {- yield >> -} return ()

main :: IO ()
main = do _ <- timeout 5000000 $ forever doit
          return ()

This program failed to terminate. But when I compiled -with threaded
and added a yield to doit, it worked (kinda). If the timeout in doit
is not too long, like 200 milliseconds, the program has constant space
usage. But when I increased the timeout in doit to 12 seconds I got a
stack overflow.

I'll investigate further when I have more time.

Regards,
Roel


More information about the Haskell-Cafe mailing list