Cancellation Module
Effects that run other effects in a CancellationScope. The environment begins the scope and
grows into the environment of the effect, which provides the scope as its
ICancellationProvider: so CancellationSource.getToken, Time.delay and the
retry delays of Orsak.Resilience see the scope's token, and CancellationSource.cancel cancels only
the scope.
Functions and values
| Function or value |
Description
|
Full Usage:
timeout duration onTimeout body
Parameters:
TimeSpan
-
How long the effect may run.
onTimeout : 'e
-
The error to fail with when it times out.
body : Effect<'Inner, 'a, 'e>
-
The effect to run in the scope, an effect of the grown environment.
Returns: Effect<'Outer, 'a, 'e>
Type parameters: 'Outer, 'Inner, 'a, 'e (requires :> Orsak.Scoped.IGrowsInto<Orsak.CancellationScope,'Inner>) |
Runs body in a new cancellation scope that is cancelled after duration,
and fails with onTimeout if it is. Unlike Cancelling the token the scope is linked to, or cancelling the scope from within, is not a timeout: the cancellation propagates as an exception, as without the timeout.
Example
|
|
Runs body in a new cancellation scope, disposed when body ends. In an
environment that is in a scope already, the new scope is nested in it, when the environment begins it so, with
Example
val importAll: files: 'a -> 'b
val files: 'a
|
Orsak