IOUsing

com.phasmidsoftware.tableparser.cats.util.IOUsing
object IOUsing

Cats effect IO equivalent of TryUsing

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
IOUsing.type

Members list

Value members

Concrete methods

def apply[R : Releasable, A](resource: => R)(f: R => IO[A]): IO[A]

This apply method is to allow proper handling of Releasable resources, using IO.

This apply method is to allow proper handling of Releasable resources, using IO.

Type parameters

A

the underlying type of the result.

R

the resource type.

Value parameters

f

a function of R => IO[A].

resource

a resource which is used by f and will be managed by Resource.

Attributes

Returns

a IO[A], the result of invoking apply(IO.blocking(resource))(f).

def apply[R : Releasable, A](ri: IO[R])(f: R => IO[A]): IO[A]

This alternative apply method signature is to allow proper handling of Releasable resources which are themselves wrapped in IO, using IO. This method is to Using.apply as flatMap is to Map.

This alternative apply method signature is to allow proper handling of Releasable resources which are themselves wrapped in IO, using IO. This method is to Using.apply as flatMap is to Map.

CONSIDER making the ri parameter non-strict (but then we would have to rename this method something else).

Type parameters

A

the underlying type of the result.

R

the resource type.

Value parameters

f

a function of R => IO[A].

ri

an IO of a resource which is to be used by f and will be managed by Resource.

Attributes

Returns

a IO[A]

def apply[R : Releasable, A](ry: Try[R])(f: R => IO[A]): IO[A]

This alternative apply method signature is to allow proper handling of Releasable resources which are themselves wrapped in Try, using IO.

This alternative apply method signature is to allow proper handling of Releasable resources which are themselves wrapped in Try, using IO.

CONSIDER making the ry parameter non-strict (but then we would have to rename this method something else).

Type parameters

A

the underlying type of the result.

R

the resource type.

Value parameters

f

a function of R => IO[A].

ry

a Try of a resource which is to be used by f and will be managed by Resource.

Attributes

Returns

a IO[A]