timeout method

IO<A> timeout(
  1. Duration duration
)

Creates an IO that returns the value of this IO, or raises an error if the evaluation take longer than duration.

Implementation

IO<A> timeout(Duration duration) => timeoutTo(
    duration,
    IO.defer(() => IO.raiseError(
        RuntimeException(TimeoutException(duration.toString())))));