Resource
data constructor that wraps an effect allocating a resource,
along with its finalizers.
Resource
data constructor that encodes the flatMap
operation.
Resource
data constructor that suspends the evaluation of another
resource value.
Creates a resource from an allocating effect.
Creates a resource from an allocating effect.
the effect type in which the resource is acquired and released
the type of the resource
an effect that returns a tuple of a resource and an effect to release it
make for a version that separates the needed resource with its finalizer tuple in two parameters
Creates a resource from an allocating effect, with a finalizer that is able to distinguish between exit cases.
Creates a resource from an allocating effect, with a finalizer that is able to distinguish between exit cases.
the effect type in which the resource is acquired and released
the type of the resource
an effect that returns a tuple of a resource and an effectful function to release it
makeCase for a version that separates the needed resource with its finalizer tuple in two parameters
Creates a Resource by wrapping a Java AutoCloseable.
Creates a Resource by wrapping a Java AutoCloseable.
Example:
import java.io._ import cats.effect._ def reader[F[_]](file: File)(implicit F: Sync[F]): Resource[F, BufferedReader] = Resource.fromAutoCloseable(F.delay { new BufferedReader(new FileReader(file)) })
the type of the effect
the type of the autocloseable resource
The effect with the resource to acquire.
the effect type in which the resource was acquired and will be released
a Resource that will automatically close after use
Lifts an applicative into a resource.
Lifts an applicative into a resource. The resource has a no-op release.
the value to lift into a resource
Creates a resource from an acquiring effect and a release function.
Creates a resource from an acquiring effect and a release function.
This builder mirrors the signature of Bracket.bracket.
the effect type in which the resource is acquired and released
the type of the resource
a function to effectfully acquire a resource
a function to effectfully release the resource returned by acquire
Creates a resource from an acquiring effect and a release function that can discriminate between different exit cases.
Creates a resource from an acquiring effect and a release function that can discriminate between different exit cases.
This builder mirrors the signature of Bracket.bracketCase.
the effect type in which the resource is acquired and released
the type of the resource
a function to effectfully acquire a resource
a function to effectfully release the resource returned by acquire
Lifts a pure value into a resource.
Lifts a pure value into a resource. The resouce has a no-op release.
the value to lift into a resource
Given a Resource
suspended in F[_]
, lifts it in the Resource
context.
Implementation for the tailRecM
operation, as described via
the cats.Monad
type class.