Class

cats.effect.Resource

Allocate

Related Doc: package Resource

Permalink

final case class Allocate[F[_], A](resource: F[(A, (ExitCase[Throwable]) ⇒ F[Unit])]) extends Resource[F, A] with Product with Serializable

Resource data constructor that wraps an effect allocating a resource, along with its finalizers.

Source
Resource.scala
Linear Supertypes
Serializable, Serializable, Product, Equals, Resource[F, A], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Allocate
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Resource
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Allocate(resource: F[(A, (ExitCase[Throwable]) ⇒ F[Unit])])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def allocated(implicit F: Bracket[F, Throwable]): F[(A, F[Unit])]

    Permalink

    Given a Resource, possibly built by composing multiple Resources 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 multiple Resources 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 outer F succeeds, it's up to the user to ensure the returned F[Unit] is called once A needs to be released. If the returned F[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 and after methods of many test frameworks), or complex library code that needs to modify or move the finalizer for an existing resource.

    Definition Classes
    Resource
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def evalMap[B](f: (A) ⇒ F[B])(implicit F: Applicative[F]): Resource[F, B]

    Permalink

    Applies an effectful transformation to the allocated resource.

    Applies an effectful transformation to the allocated resource. Like a flatMap on F[A] while maintaining the resource context

    Definition Classes
    Resource
  9. def evalTap[B](f: (A) ⇒ F[B])(implicit F: Applicative[F]): Resource[F, A]

    Permalink

    Applies an effectful transformation to the allocated resource.

    Applies an effectful transformation to the allocated resource. Like a flatTap on F[A] while maintaining the resource context

    Definition Classes
    Resource
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def flatMap[B](f: (A) ⇒ Resource[F, B]): Resource[F, B]

    Permalink

    Implementation for the flatMap operation, as described via the cats.Monad type class.

    Implementation for the flatMap operation, as described via the cats.Monad type class.

    Definition Classes
    Resource
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. def map[B](f: (A) ⇒ B)(implicit F: Applicative[F]): Resource[F, B]

    Permalink

    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
  15. def mapK[G[_]](f: ~>[F, G])(implicit B: Bracket[F, Throwable], D: Defer[G], G: Applicative[G]): Resource[G, A]

    Permalink

    Given a natural transformation from F to G, transforms this Resource from effect F to effect G.

    Given a natural transformation from F to G, transforms this Resource from effect F to effect G.

    Definition Classes
    Resource
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. val resource: F[(A, (ExitCase[Throwable]) ⇒ F[Unit])]

    Permalink
  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  21. def use[B](f: (A) ⇒ F[B])(implicit F: Bracket[F, Throwable]): F[B]

    Permalink

    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
  22. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Resource[F, A]

Inherited from AnyRef

Inherited from Any

Ungrouped