Effects are functorial, monadic, and applicative types that are designed to capture IO based side-effects.
| Section | Type | Description |
|---|---|---|
IO |
IO<A> |
Asynchronous and synchronous IO. Captures side-effects, manages resources, but throws exceptions. The IO monad is the base of all IO based operations and should be used in your monad-transformer stacks when you need IO. |
Eff |
Eff<A> |
Asynchronous and synchronous IO. Captures side-effects, manages resources, handles exceptions elegantly. |
Eff |
Eff<RT, A> |
Asynchronous and synchronous IO. Captures side-effects, manages resources, handles exceptions elegantly, and has an injectable runtime (RT) which can provide configuration and dependency-injection |
Contents
- MinRT
- Prelude
- tailIO <M, A> (K<M, A> ma)
- postIO <M, A> (K<M, A> ma)
- mapIO <M, A, B> (K<M, A> ma, Func<IO<A>, IO<B>> f)
- uninterruptible <M, A> (K<M, A> ma)
- localIO <M, A> (K<M, A> ma)
- fork <M, A> (K<M, A> ma, Option<TimeSpan> timeout = default)
- awaitIO <M, A> (K<M, ForkIO<A>> ma)
- awaitAll <M, A> (params K<M, A>[] ms)
- awaitAll <M, A> (params K<M, ForkIO<A>>[] forks)
- awaitAll <M, A> (Seq<K<M, A>> ms)
- awaitAll <M, A> (Seq<K<M, ForkIO<A>>> forks)
- awaitAny <M, A> (params K<M, A>[] ms)
- awaitAny <M, A> (params K<M, ForkIO<A>>[] forks)
- awaitAny <M, A> (Seq<K<M, ForkIO<A>>> forks)
- awaitAny <M, A> (Seq<K<M, A>> forks)
- timeout <M, A> (TimeSpan timeout, K<M, A> ma)
- repeat <M, A> (K<M, A> ma)
- repeat <M, A> (Schedule schedule, K<M, A> ma)
- repeatWhile <M, A> (K<M, A> ma, Func<A, bool> predicate)
- repeatWhile <M, A> ( Schedule schedule, K<M, A> ma, Func<A, bool> predicate)
- repeatUntil <M, A> ( K<M, A> ma, Func<A, bool> predicate)
- repeatUntil <M, A> ( Schedule schedule, K<M, A> ma, Func<A, bool> predicate)
- retry <M, A> (K<M, A> ma)
- retry <M, A> (Schedule schedule, K<M, A> ma)
- retryWhile <M, A> ( K<M, A> ma, Func<Error, bool> predicate)
- retryWhile <M, A> ( Schedule schedule, K<M, A> ma, Func<Error, bool> predicate)
- retryUntil <M, A> ( K<M, A> ma, Func<Error, bool> predicate)
- retryUntil <M, A> ( Schedule schedule, K<M, A> ma, Func<Error, bool> predicate)
Sub modules
| Eff |
| IO |
| Schedule |
Methods
method K<M, A> tailIO <M, A> (K<M, A> ma) Source #
Tail call
Parameters
| type | A | |
| param | ma | |
| returns | ||
method K<M, A> postIO <M, A> (K<M, A> ma) Source #
Make this computation run on the SynchronizationContext that was captured at the start
of the IO chain (i.e. the one embedded within the EnvIO environment that is passed through
all IO computations)
method K<M, B> mapIO <M, A, B> (K<M, A> ma, Func<IO<A>, IO<B>> f) Source #
Queue this IO operation to run on the thread-pool.
Parameters
| param | timeout | Maximum time that the forked IO operation can run for. |
| returns | Returns a | |
method K<M, A> uninterruptible <M, A> (K<M, A> ma) Source #
Wraps this computation in a local-environment that ignores any cancellation-token cancellation requests.
Parameters
| returns | An uninterruptible computation | |
method K<M, A> localIO <M, A> (K<M, A> ma) Source #
Creates a local cancellation environment
A local cancellation environment stops other IO computations, that rely on the same environmental cancellation token, from being taken down by a regional cancellation.
If an IO.cancel is invoked locally, then it will still create an exception that
propagates upwards and so catching cancellations is still important.
Parameters
| type | A | Bound value |
| param | ma | Computation to run within the local context |
| returns | Result of the computation | |
method K<M, ForkIO<A>> fork <M, A> (K<M, A> ma, Option<TimeSpan> timeout = default) Source #
Queue this IO operation to run on the thread-pool.
Parameters
| param | timeout | Maximum time that the forked IO operation can run for. |
| returns | Returns a | |
method K<M, A> awaitIO <M, A> (K<M, ForkIO<A>> ma) Source #
Queue this IO operation to run on the thread-pool.
Parameters
| param | timeout | Maximum time that the forked IO operation can run for. |
| returns | Returns a | |
method K<M, Seq<A>> awaitAll <M, A> (params K<M, A>[] ms) Source #
Awaits all operations
Parameters
| param | ms | Operations to await |
| returns | Sequence of results | |
method K<M, Seq<A>> awaitAll <M, A> (params K<M, ForkIO<A>>[] forks) Source #
Awaits all forks
Parameters
| param | forks | Forks to await |
| returns | Sequence of results | |
method K<M, Seq<A>> awaitAll <M, A> (Seq<K<M, A>> ms) Source #
Awaits all operations
Parameters
| param | ms | Operations to await |
| returns | Sequence of results | |
method K<M, Seq<A>> awaitAll <M, A> (Seq<K<M, ForkIO<A>>> forks) Source #
Awaits all forks
Parameters
| param | forks | Forks to await |
| returns | Sequence of results | |
method K<M, A> awaitAny <M, A> (params K<M, A>[] ms) Source #
Awaits for any operation to complete
Parameters
| param | ms | Operations to await |
| returns | If we get one success, then we'll return straight away and cancel the others. If we get any errors, we'll collect them in the hope that at least one works. If we have collected as many errors as we have forks, then we'll return them all. | |
method K<M, A> awaitAny <M, A> (params K<M, ForkIO<A>>[] forks) Source #
Awaits for any forks to complete
Parameters
| param | forks | Forks to await |
| returns | If we get one success, then we'll return straight away and cancel the others. If we get any errors, we'll collect them in the hope that at least one works. If we have collected as many errors as we have forks, then we'll return them all. | |
method K<M, A> awaitAny <M, A> (Seq<K<M, ForkIO<A>>> forks) Source #
Awaits for any forks to complete
Parameters
| param | forks | Forks to await |
| returns | If we get one success, then we'll return straight away and cancel the others. If we get any errors, we'll collect them in the hope that at least one works. If we have collected as many errors as we have forks, then we'll return them all. | |
method K<M, A> awaitAny <M, A> (Seq<K<M, A>> forks) Source #
Awaits for operations to complete
Parameters
| param | ms | Operations to await |
| returns | If we get one success, then we'll return straight away and cancel the others. If we get any errors, we'll collect them in the hope that at least one works. If we have collected as many errors as we have forks, then we'll return them all. | |
method K<M, A> timeout <M, A> (TimeSpan timeout, K<M, A> ma) Source #
Timeout operation if it takes too long
method K<M, A> repeat <M, A> (K<M, A> ma) Source #
Keeps repeating the computation
Parameters
| type | A | Computation bound value type |
| param | ma | Computation to repeat |
| returns | The result of the last invocation of | |
method K<M, A> repeat <M, A> (Schedule schedule, K<M, A> ma) Source #
Keeps repeating the computation, until the scheduler expires
Parameters
| type | A | Computation bound value type |
| param | schedule | Scheduler strategy for repeating |
| param | ma | Computation to repeat |
| returns | The result of the last invocation of | |
method K<M, A> repeatWhile <M, A> (K<M, A> ma, Func<A, bool> predicate) Source #
Keeps repeating the computation until the predicate returns false
Parameters
| type | A | Computation bound value type |
| param | ma | Computation to repeat |
| returns | The result of the last invocation of | |
method K<M, A> repeatWhile <M, A> ( Schedule schedule, K<M, A> ma, Func<A, bool> predicate) Source #
Keeps repeating the computation until the scheduler expires, or the predicate returns false
Parameters
| type | A | Computation bound value type |
| param | schedule | Scheduler strategy for repeating |
| param | ma | Computation to repeat |
| returns | The result of the last invocation of | |
method K<M, A> repeatUntil <M, A> ( K<M, A> ma, Func<A, bool> predicate) Source #
Keeps repeating the computation until the predicate returns true
Parameters
| type | A | Computation bound value type |
| param | ma | Computation to repeat |
| returns | The result of the last invocation of | |
method K<M, A> repeatUntil <M, A> ( Schedule schedule, K<M, A> ma, Func<A, bool> predicate) Source #
Keeps repeating the computation until the scheduler expires, or the predicate returns true
Parameters
| type | A | Computation bound value type |
| param | schedule | Scheduler strategy for repeating |
| param | ma | Computation to repeat |
| returns | The result of the last invocation of | |
method K<M, A> retry <M, A> (K<M, A> ma) Source #
Keeps retrying the computation
Parameters
| type | A | Computation bound value type |
| param | ma | Computation to retry |
| returns | The result of the last invocation of ma | |
method K<M, A> retry <M, A> (Schedule schedule, K<M, A> ma) Source #
Keeps retrying the computation until the scheduler expires
Parameters
| type | A | Computation bound value type |
| param | schedule | Scheduler strategy for retrying |
| param | ma | Computation to retry |
| returns | The result of the last invocation of ma | |
method K<M, A> retryWhile <M, A> ( K<M, A> ma, Func<Error, bool> predicate) Source #
Keeps retrying the computation until the predicate returns false
Parameters
| type | A | Computation bound value type |
| param | ma | Computation to retry |
| returns | The result of the last invocation of ma | |
method K<M, A> retryWhile <M, A> ( Schedule schedule, K<M, A> ma, Func<Error, bool> predicate) Source #
Keeps retrying the computation until the scheduler expires, or the predicate returns false
Parameters
| type | A | Computation bound value type |
| param | schedule | Scheduler strategy for retrying |
| param | ma | Computation to retry |
| returns | The result of the last invocation of ma | |
method K<M, A> retryUntil <M, A> ( K<M, A> ma, Func<Error, bool> predicate) Source #
Keeps retrying the computation until the predicate returns true
Parameters
| type | A | Computation bound value type |
| param | ma | Computation to retry |
| returns | The result of the last invocation of ma | |
method K<M, A> retryUntil <M, A> ( Schedule schedule, K<M, A> ma, Func<Error, bool> predicate) Source #
Keeps retrying the computation until the scheduler expires, or the predicate returns true
Parameters
| type | A | Computation bound value type |
| param | schedule | Scheduler strategy for retrying |
| param | ma | Computation to retry |
| returns | The result of the last invocation of ma | |