
14 Nov
2006
14 Nov
'06
6:55 a.m.
On 11/14/06, David Menendez
Peter Simons writes:
data TimeoutError = TimeoutError deriving (Show, Typeable) type Microseconds = Int
timeout :: Microseconds -> IO a -> IO a
This seems like a good place to use DiffTime, from Data.Time.Clock. That way, you can specify timeouts using (fractional) seconds and avoid confusion as to whether timeout uses microseconds, milliseconds, or nanoseconds.
Unforunately, Data.Time.Clock is in the time package. An alternative is Micro, from Data.Fixed.
Seems to me that the obvious choice is to use the proper SI unit of seconds, and pass it in as a Double (or have it be polymorphic and constrained to RealFrac). /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862