data-timeout-0.3: 64-bit timeouts of nanosecond precision

Safe HaskellNone

Data.Timeout

Synopsis

Documentation

data TimedOut Source

Exception that is raised when an operation times out. Not used by the package itself, it is here so that users don't need to roll their own exception type every time.

Constructors

TimedOut 

timeoutUnitNanos :: TimeoutUnit -> Word64Source

Amount of nanoseconds in a timeout unit.

newtype Timeout Source

Timeout in nanoseconds. The Printable instance renders timeouts as series of AmountUnit tokens, e.g.

      toString (1 # Day + 1500 # MilliSecond) = "1d1s500ms"

The full list of timeout unit abbreviations:

The Textual instance accepts this syntax and allows decimal fractions to be used as amounts:

     fmap toString (fromStringAs aTimeout "1m1.5s0.2us") = Just "1m1s500ms200ns"

Constructors

Timeout Word64 

(#) :: Word64 -> TimeoutUnit -> TimeoutSource

Convert the given number of timeout units to Timeout.

(#>) :: Timeout -> TimeoutUnit -> Word64Source

Extract number of units (rounding up).

(#<) :: Timeout -> TimeoutUnit -> Word64Source

Extract number of units (rounding down).

instantly :: TimeoutSource

Zero timeout. The event in question should occur immediately.