At 2002-09-10 03:03, Koen Claessen wrote:
What is the recommended way of implementing the function:
timeOut :: Int -> IO a -> IO (Maybe a)
which takes a maximum number of seconds (say), an IO action, and tries to run the IO action in the specified time. If it succeeds, it returns just the answer, otherwise it returns Nothing.
Sounds rather unsafe. What happens to the IO action after the specified time? -- Ashley Yakeley, Seattle WA
Ashley Yakeley wrote: | > timeOut :: Int -> IO a -> IO (Maybe a) : | Sounds rather unsafe. What happens to the IO action | after the specified time? Good point. Actually, a function of the type: timeOut :: Int -> a -> IO (Maybe a) would suffice for my purposes, but I tried to be a bit more general when I posed my question. /Koen.
participants (2)
-
Ashley Yakeley -
Koen Claessen