Variables bracket bracket
: < Resource , EOpen , EClose > ( open
: IO < Resource , EOpen > , close
: ( r
: Resource ) => IO < unknown , EClose > ) => < A , EUse > ( use
: ( r
: Resource ) => IO < A , EUse > ) => IO < A , EOpen | EClose | EUse > Type declaration < Resource , EOpen , EClose > ( open: IO < Resource , EOpen > , close: ( r: Resource ) => IO < unknown , EClose > ) : < A , EUse > ( use: ( r: Resource ) => IO < A , EUse > ) => IO < A , EOpen | EClose | EUse > Type parameters Parameters open: IO < Resource , EOpen > close: ( r: Resource ) => IO < unknown , EClose > ( r: Resource ) : IO < unknown , EClose > Parameters Returns IO < unknown , EClose > Returns < A , EUse > ( use: ( r: Resource ) => IO < A , EUse > ) => IO < A , EOpen | EClose | EUse > < A , EUse > ( use: ( r: Resource ) => IO < A , EUse > ) : IO < A , EOpen | EClose | EUse > Type parameters Parameters use: ( r: Resource ) => IO < A , EUse > ( r: Resource ) : IO < A , EUse > Parameters Returns IO < A , EUse > Returns IO < A , EOpen | EClose | EUse > cancel cancel
: ( ) => IO < never , never > cancelable cancelable
: < A > ( cancelableEffect
: ( ) => { promise
: Promise < A > ; cancel
: any } ) => IO < A , unknown > Type declaration < A > ( cancelableEffect: ( ) => { promise: Promise < A > ; cancel: any } ) : IO < A , unknown > Type parameters Parameters cancelableEffect: ( ) => { promise: Promise < A > ; cancel: any } ( ) : { promise: Promise < A > ; cancel: any } Returns { promise: Promise < A > ; cancel: any } promise: Promise < A > cancel: function Returns IO < A , unknown > lift lift
: < Args , Return > ( func
: ( ... args
: Args ) => Return | Promise < Return > ) => ( ... args
: Args ) => IO < Return > Type declaration < Args , Return > ( func: ( ... args: Args ) => Return | Promise < Return > ) : ( ... args: Args ) => IO < Return > Type parameters Parameters func: ( ... args: Args ) => Return | Promise < Return > ( ... args: Args ) : Return | Promise < Return > Parameters Returns Return | Promise < Return > Returns ( ... args: Args ) => IO < Return > ( ... args: Args ) : IO < Return > Parameters Returns IO < Return > parallel parallel
: < Actions > ( actions
: Actions ) => IO < ValuesArray < Actions > , UnionOfErrors < Actions > > Type declaration < Actions > ( actions: Actions ) : IO < ValuesArray < Actions > , UnionOfErrors < Actions > > Type parameters Actions: readonly IO < unknown , unknown > [] Parameters Returns IO < ValuesArray < Actions > , UnionOfErrors < Actions > > race race
: < Actions > ( actions
: Actions ) => IO < UnionOfValues < Actions > , UnionOfErrors < Actions > | ( Actions extends { 0
: unknown } ? never : TypeError ) > Type declaration < Actions > ( actions: Actions ) : IO < UnionOfValues < Actions > , UnionOfErrors < Actions > | ( Actions extends { 0: unknown } ? never : TypeError ) > Type parameters Actions: readonly IO < unknown , unknown > [] Parameters Returns IO < UnionOfValues < Actions > , UnionOfErrors < Actions > | ( Actions extends { 0: unknown } ? never : TypeError ) > raise raise
: < E > ( error
: E ) => IO < never , E > Type declaration < E > ( error: E ) : IO < never , E > Type parameters Parameters Returns IO < never , E > sequence sequence
: < Actions > ( actions
: Actions ) => IO < ValuesArray < Actions > , UnionOfErrors < Actions > > Type declaration < Actions > ( actions: Actions ) : IO < ValuesArray < Actions > , UnionOfErrors < Actions > > Type parameters Actions: readonly IO < unknown , unknown > [] Parameters Returns IO < ValuesArray < Actions > , UnionOfErrors < Actions > > uncancelable uncancelable
: < A , E > ( action
: IO < A , E > ) => IO < A , E > Type declaration < A , E > ( action: IO < A , E > ) : IO < A , E > Type parameters Parameters Returns IO < A , E > wait wait
: ( time
: number , units
: "millisecond" | "milliseconds" | "seconds" | "second" | "minute" | "minutes" | "hour" | "hours" ) => IO < void , never > Type declaration ( time: number , units: "millisecond" | "milliseconds" | "seconds" | "second" | "minute" | "minutes" | "hour" | "hours" ) : IO < void , never > Parameters time: number units: "millisecond" | "milliseconds" | "seconds" | "second" | "minute" | "minutes" | "hour" | "hours" Returns IO < void , never > wrap wrap
: < A > ( value
: A ) => IO < A , never > Type declaration < A > ( value: A ) : IO < A , never > Type parameters Parameters Returns IO < A , never > Legend Namespace Variable Function with type parameter Type alias with type parameter Class Class with type parameter Settings Theme OS Light Dark
Creates a wrapper function which will use an
open
action to acquire a resource andclose
action to release it. If theopen
action succeeds, then theclose
function is guaranteed to be called. This can be used where you might use atry... finally
block in imperative code, when a clean up action must always be taken.