
6 Sep
2008
6 Sep
'08
2:16 p.m.
a -> IO (Either a a ) and use getCPUTime.
Is there a standard way to do this? Can you think of another way to do it?
I don't know, but this seems relevant: http://www.haskell.org/pipermail/haskell-cafe/2005-October/011946.html
I'd make a generic (i.e. higher-order) function that handles the timeout for any computation. i.e.
timeout :: (a -> b) -> Int -> a -> IO (Maybe b)
http://haskell.org/ghc/docs/latest/html/libraries/base/System-Timeout Perhaps this is for not so much for pure computations as hanging when connecting to nonresponsive servers, although I also use it in a case where buggy long-running code could frustrate the responsiveness of unrelated processes.. --Lane