Contents
- Prelude
- use <M, A> (K<M, A> acquire, Action<A> release)
- use <A> (IO<A> acquire, Action<A> release)
- use <A> (Func<A> acquire, Action<A> release)
- use <A> (Func<A> acquire, Func<A, IO<Unit>> release)
- use <M, A> (K<M, A> acquire, Func<A, IO<Unit>> release)
- use <A> (IO<A> acquire, Func<A, IO<Unit>> release)
- use <A> (Func<EnvIO, A> acquire)
- use <A> (Func<A> acquire)
- useAsync <A> (Func<A> acquire)
- use <M, A> (K<M, A> acquire)
- use <A> (IO<A> acquire)
- useAsync <M, A> (K<M, A> acquire)
- useAsync <A> (IO<A> acquire)
- release <A> (A value)
- bracketIO <M, A> (K<M, A> computation)
- bracketIO <M, A> (IO<A> computation)
- bracketIO <M, A, B, C> (K<M, A> Acq, Func<A, IO<C>> Use, Func<A, IO<B>> Fin)
- bracketIO <M, A, B, C> (IO<A> Acq, Func<A, IO<C>> Use, Func<A, IO<B>> Fin)
- bracketIO <M, A, B, C> (K<M, A> Acq, Func<A, IO<C>> Use, Func<Error, IO<C>> Catch, Func<A, IO<B>> Fin)
- bracketIO <M, A, B, C> (IO<A> Acq, Func<A, IO<C>> Use, Func<Error, IO<C>> Catch, Func<A, IO<B>> Fin)
Methods
method K<M, A> use <M, A> (K<M, A> acquire, Action<A> release) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with bracketIO.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| param | release | Action to release the resource |
| returns | Acquired resource | |
method IO<A> use <A> (IO<A> acquire, Action<A> release) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with bracketIO.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| param | release | Action to release the resource |
| returns | Acquired resource | |
method IO<A> use <A> (Func<A> acquire, Action<A> release) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with @using.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| param | release | Action to release the resource |
| returns | Acquired resource | |
method IO<A> use <A> (Func<A> acquire, Func<A, IO<Unit>> release) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with @using.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| param | release | Action to release the resource |
| returns | Acquired resource | |
method K<M, A> use <M, A> (K<M, A> acquire, Func<A, IO<Unit>> release) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with @using.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| param | release | Action to release the resource |
| returns | Acquired resource | |
method IO<A> use <A> (IO<A> acquire, Func<A, IO<Unit>> release) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with @using.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| param | release | Action to release the resource |
| returns | Acquired resource | |
method IO<A> use <A> (Func<EnvIO, A> acquire) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with @using.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| returns | Acquired resource | |
method IO<A> use <A> (Func<A> acquire) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with @using.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| returns | Acquired resource | |
method IO<A> useAsync <A> (Func<A> acquire) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with @using.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| returns | Acquired resource | |
method K<M, A> use <M, A> (K<M, A> acquire) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with @using.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| returns | Acquired resource | |
method IO<A> use <A> (IO<A> acquire) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with @using.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| returns | Acquired resource | |
method K<M, A> useAsync <M, A> (K<M, A> acquire) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with @using.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| returns | Acquired resource | |
method IO<A> useAsync <A> (IO<A> acquire) Source #
Acquire a resource and have it tracked by the IO environment. The resource
can be released manually using release or from wrapping a section of IO
code with @using.
Parameters
| type | A | Bound value type |
| param | acquire | Computation that acquires the resource |
| returns | Acquired resource | |
method IO<Unit> release <A> (A value) Source #
Release the resource from the tracked IO environment
Parameters
| type | A | Bound value type |
| param | value | Resource to release |
| returns | Unit | |
method K<M, A> bracketIO <M, A> (K<M, A> computation) Source #
The IO monad tracks resources automatically; this creates a local resource environment
to run the computation in. Once the computation is completed, any resources acquired
are automatically released. Imagine this as the ultimate using statement.
Parameters
| type | A | Bound value type |
| param | computation | Computation to run in a local scope |
| returns | Result of computation | |
method IO<A> bracketIO <M, A> (IO<A> computation) Source #
The IO monad tracks resources automatically; this creates a local resource environment
to run the computation in. Once the computation is completed, any resources acquired
are automatically released. Imagine this as the ultimate using statement.
Parameters
| type | A | Bound value type |
| param | computation | Computation to run in a local scope |
| returns | Result of computation | |
method K<M, C> bracketIO <M, A, B, C> (K<M, A> Acq, Func<A, IO<C>> Use, Func<A, IO<B>> Fin) Source #
When acquiring, using, and releasing various resources, it can be quite convenient to write a function to manage the acquisition and releasing, taking a function of the acquired value that specifies an action to be performed in between.
Consider using bracketIO(computation) rather than bracket(acq, use, fin), the semantics are more attractive
as there's no need to provide function handlers, the cleanup is automatic.
Parameters
| param | Acq | Acquire resource |
| param | Use | Function to use the acquired resource |
| param | Fin | Function to invoke to release the resource |
method IO<C> bracketIO <M, A, B, C> (IO<A> Acq, Func<A, IO<C>> Use, Func<A, IO<B>> Fin) Source #
When acquiring, using, and releasing various resources, it can be quite convenient to write a function to manage the acquisition and releasing, taking a function of the acquired value that specifies an action to be performed in between.
Consider using bracketIO(computation) rather than bracket(acq, use, fin), the semantics are more attractive
as there's no need to provide function handlers, the cleanup is automatic.
Parameters
| param | Acq | Acquire resource |
| param | Use | Function to use the acquired resource |
| param | Fin | Function to invoke to release the resource |
method K<M, C> bracketIO <M, A, B, C> (K<M, A> Acq, Func<A, IO<C>> Use, Func<Error, IO<C>> Catch, Func<A, IO<B>> Fin) Source #
When acquiring, using, and releasing various resources, it can be quite convenient to write a function to manage the acquisition and releasing, taking a function of the acquired value that specifies an action to be performed in between.
Consider using bracketIO(computation) rather than bracket(acq, use, fin), the semantics are more attractive
as there's no need to provide function handlers, the cleanup is automatic.
Parameters
| param | Acq | Acquire resource |
| param | Use | Function to use the acquired resource |
| param | Catch | Function called when an |
| param | Finally | Function to invoke to release the resource |
method IO<C> bracketIO <M, A, B, C> (IO<A> Acq, Func<A, IO<C>> Use, Func<Error, IO<C>> Catch, Func<A, IO<B>> Fin) Source #
When acquiring, using, and releasing various resources, it can be quite convenient to write a function to manage the acquisition and releasing, taking a function of the acquired value that specifies an action to be performed in between.
Consider using bracketIO(computation) rather than bracket(acq, use, fin), the semantics are more attractive
as there's no need to provide function handlers, the cleanup is automatic.
Parameters
| param | Acq | Acquire resource |
| param | Use | Function to use the acquired resource |
| param | Catch | Function called when an |
| param | Finally | Function to invoke to release the resource |