* Lift a pure value into a resource
export function pure<R = T.NoEnv, E = T.NoErr, A = unknown>(
* Create a Resource by wrapping an IO producing a value that does not need to be disposed
export function encaseEffect<R, E, A>(
* Create a resource from an acquisition and release function
export function bracket<R, E, A, R2, E2>(
acquire: T.Effect<R, E, A>,
release: FunctionN<[A], T.Effect<R2, E2, unknown>>
): Managed<R & R2, E | E2, A>
export function bracketExit<R, E, A, R2, E2>(
acquire: T.Effect<R, E, A>,
release: FunctionN<[A, Exit<E, unknown>], T.Effect<R2, E2, unknown>>
): Managed<R & R2, E | E2, A>
* Lift an IO of a Resource into a resource
export function suspend<R, E, R2, E2, A>(
suspended: T.Effect<R, E, Managed<R2, E2, A>>
): Managed<R & R2, E | E2, A>
* Compose dependent resourcess.
* The scope of left will enclose the scope of the resource produced by bind
export function chain<R, E, L, A>(
bind: FunctionN<[L], Managed<R, E, A>>
): <R2, E2>(ma: Managed<R2, E2, L>) => Managed<R & R2, E | E2, A>
export function map<L, A>(
): <R, E>(res: Managed<R, E, L>) => Managed<R, E, A>
* Zip two resources together with the given function.
* The scope of resa will enclose the scope of resb
export function zipWith<R, E, A, R2, E2, B, C>(
resb: Managed<R2, E2, B>,
): Managed<R & R2, E | E2, C>
* Zip two resources together as a tuple.
* The scope of resa will enclose the scope of resb
export function zip<R, E, A, R2, E2, B>(
): Managed<R & R2, E | E2, readonly [A, B]>
* Apply the function produced by resfab to the value produced by resa to produce a new resource.
export function ap<R, E, A, R2, E2, B>(
resfab: Managed<R2, E2, FunctionN<[A], B>>
): Managed<R & R2, E | E2, B>
function ap_<R, E, A, B, R2, E2>(
resfab: Managed<R, E, FunctionN<[A], B>>,
): Managed<R & R2, E | E2, B>
* Map a resource to a static value
* This creates a resource of the provided constant b where the produced A has the same lifetime internally
export function as<R, E, A, B>(fa: Managed<R, E, A>, b: B): Managed<R, E, B>
): <R, E, A>(fa: Managed<R, E, A>) => Managed<R, E, B>
* Construct a new 'hidden' resource using the produced A with a nested lifetime
* Useful for performing initialization and cleanup that clients don't need to see
export function chainTap<R, E, A, R2, E2>(
bind: FunctionN<[A], Managed<R2, E2, unknown>>
): Managed<R & R2, E | E2, A>
* Curried form of chainTap
export function chainTapWith<R, E, A>(
bind: FunctionN<[A], Managed<R, E, unknown>>
): FunctionN<[Managed<R, E, A>], Managed<R, E, A>>
* Curried data last form of use
export function consume<R, E, A, B>(
f: FunctionN<[A], T.Effect<R, E, B>>
): <R2, E2>(ma: Managed<R2, E2, A>) => T.Effect<R & R2, E | E2, B>
* Create a Resource from the fiber of an IO.
* The acquisition of this resource corresponds to forking rio into a fiber.
* The destruction of the resource is interrupting said fiber.
export function fiber<R, E, A>(
): Managed<R, never, T.Fiber<E, A>>
* Use a resource to produce a program that can be run.s
export function use<R, E, A, R2, E2, B>(
f: FunctionN<[A], T.Effect<R2, E2, B>>
): T.Effect<R & R2, E | E2, B>
export interface Leak<R, E, A> {
release: T.Effect<R, E, unknown>;
* Create an IO action that will produce the resource for this managed along with its finalizer
* If an error occurs during allocation then any allocated resources should be cleaned up, but once the
* Leak object is produced it is the callers responsibility to ensure release is invoked.
export function allocate<R, E, A>(
): T.Effect<R, E, Leak<R, E, A>>
* Use a resource to provide the environment to a WaveR
export function provideTo<R extends T.Env, E, R2 extends T.Env, A, E2>(
): T.Effect<R, E | E2, A>
export const managed: Monad3E<URI> = {
// semigroup for result combination
export function getSemigroup<R, E, A>(
): Semigroup<Managed<R, E, A>>
// get monoid to compose result
export function getMonoid<R, E, A>(
): Monoid<Managed<R, E, A>>
export function provideAll<R>(
): <E, A>(ma: Managed<R, E, A>) => Managed<T.NoEnv, E, A>