final case class Bind[F[_], S, A](source: Resource[F, S], fs: (S) ⇒ Resource[F, A]) extends Resource[F, A] with Product with Serializable
Resource
data constructor that encodes the flatMap
operation.
- Source
- Resource.scala
- Alphabetic
- By Inheritance
- Bind
- Serializable
- Serializable
- Product
- Equals
- Resource
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
allocated(implicit F: Bracket[F, Throwable]): F[(A, F[Unit])]
Given a
Resource
, possibly built by composing multipleResource
s monadically, returns the acquired resource, as well as an action that runs all the finalizers for releasing it.Given a
Resource
, possibly built by composing multipleResource
s monadically, returns the acquired resource, as well as an action that runs all the finalizers for releasing it.If the outer
F
fails or is interrupted,allocated
guarantees that the finalizers will be called. However, if the outerF
succeeds, it's up to the user to ensure the returnedF[Unit]
is called onceA
needs to be released. If the returnedF[Unit]
is not called, the finalizers will not be run.For this reason, this is an advanced and potentially unsafe api which can cause a resource leak if not used correctly, please prefer use as the standard way of running a
Resource
program.Use cases include interacting with side-effectful apis that expect separate acquire and release actions (like the
before
andafter
methods of many test frameworks), or complex library code that needs to modify or move the finalizer for an existing resource.- Definition Classes
- Resource
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
evalMap[B](f: (A) ⇒ F[B])(implicit F: Applicative[F]): Resource[F, B]
Applies an effectful transformation to the allocated resource.
Applies an effectful transformation to the allocated resource. Like a
flatMap
onF[A]
while maintaining the resource context- Definition Classes
- Resource
-
def
evalTap[B](f: (A) ⇒ F[B])(implicit F: Applicative[F]): Resource[F, A]
Applies an effectful transformation to the allocated resource.
Applies an effectful transformation to the allocated resource. Like a
flatTap
onF[A]
while maintaining the resource context- Definition Classes
- Resource
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flatMap[B](f: (A) ⇒ Resource[F, B]): Resource[F, B]
Implementation for the
flatMap
operation, as described via thecats.Monad
type class.Implementation for the
flatMap
operation, as described via thecats.Monad
type class.- Definition Classes
- Resource
- val fs: (S) ⇒ Resource[F, A]
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
map[B](f: (A) ⇒ B)(implicit F: Applicative[F]): Resource[F, B]
Given a mapping function, transforms the resource provided by this Resource.
Given a mapping function, transforms the resource provided by this Resource.
This is the standard
Functor.map
.- Definition Classes
- Resource
-
def
mapK[G[_]](f: ~>[F, G])(implicit B: Bracket[F, Throwable], D: Defer[G], G: Applicative[G]): Resource[G, A]
Given a natural transformation from
F
toG
, transforms this Resource from effectF
to effectG
.Given a natural transformation from
F
toG
, transforms this Resource from effectF
to effectG
.- Definition Classes
- Resource
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val source: Resource[F, S]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
use[B](f: (A) ⇒ F[B])(implicit F: Bracket[F, Throwable]): F[B]
Allocates a resource and supplies it to the given function.
Allocates a resource and supplies it to the given function. The resource is released as soon as the resulting
F[B]
is completed, whether normally or as a raised error.- f
the function to apply to the allocated resource
- returns
the result of applying [F] to
- Definition Classes
- Resource
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
This is the API documentation for the cats-effect library.
See the cats.effect package for a quick overview.
Links
Canonical documentation links:
Related Cats links (the core):