final case class Suspend[F[_], A](resource: F[Resource[F, A]]) extends Resource[F, A] with Product with Serializable
Resource data constructor that suspends the evaluation of another
resource value.
- Source
- Resource.scala
- Alphabetic
- By Inheritance
- Suspend
- 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 multipleResources 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 multipleResources monadically, returns the acquired resource, as well as an action that runs all the finalizers for releasing it.If the outer
Ffails or is interrupted,allocatedguarantees that the finalizers will be called. However, if the outerFsucceeds, it's up to the user to ensure the returnedF[Unit]is called onceAneeds 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
Resourceprogram.Use cases include interacting with side-effectful apis that expect separate acquire and release actions (like the
beforeandaftermethods 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[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
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
flatMaponF[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
flatTaponF[A]while maintaining the resource context- Definition Classes
- Resource
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flatMap[B](f: (A) ⇒ Resource[F, B]): Resource[F, B]
Implementation for the
flatMapoperation, as described via thecats.Monadtype class.Implementation for the
flatMapoperation, as described via thecats.Monadtype class.- Definition Classes
- Resource
-
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
FtoG, transforms this Resource from effectFto effectG.Given a natural transformation from
FtoG, transforms this Resource from effectFto 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 resource: F[Resource[F, A]]
-
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
- @native() @throws( ... )

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):