Tue, 10 Sep 2002 14:17:41 +0100
> 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.
It's only unsafe if your code isn't written to cope with asynchronous
exceptions. Doing this in most cases just amounts to using combinators
like Control.Exception.bracket to do the exception handling for you. In
FFI code you have to be more careful, however.