Object/Class

cats.effect

Resource

Related Docs: class Resource | package effect

Permalink

object Resource extends ResourceInstances

Source
Resource.scala
Linear Supertypes
ResourceInstances, ResourceInstances0, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Resource
  2. ResourceInstances
  3. ResourceInstances0
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

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

    Permalink

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

  2. final case class Bind[F[_], S, A](source: Resource[F, S], fs: (S) ⇒ Resource[F, A]) extends Resource[F, A] with Product with Serializable

    Permalink

    Resource data constructor that encodes the flatMap operation.

  3. final case class Suspend[F[_], A](resource: F[Resource[F, A]]) extends Resource[F, A] with Product with Serializable

    Permalink

    Resource data constructor that suspends the evaluation of another resource value.

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 apply[F[_], A](resource: F[(A, F[Unit])])(implicit F: Functor[F]): Resource[F, A]

    Permalink

    Creates a resource from an allocating effect.

    Creates a resource from an allocating effect.

    F

    the effect type in which the resource is acquired and released

    A

    the type of the resource

    resource

    an effect that returns a tuple of a resource and an effect to release it

    See also

    make for a version that separates the needed resource with its finalizer tuple in two parameters

  5. def applyCase[F[_], A](resource: F[(A, (ExitCase[Throwable]) ⇒ F[Unit])]): Resource[F, A]

    Permalink

    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.

    F

    the effect type in which the resource is acquired and released

    A

    the type of the resource

    resource

    an effect that returns a tuple of a resource and an effectful function to release it

    See also

    makeCase for a version that separates the needed resource with its finalizer tuple in two parameters

  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. implicit def catsEffectMonadErrorForResource[F[_], E](implicit F0: MonadError[F, E]): MonadError[[β$0$]Resource[F, β$0$], E]

    Permalink
    Definition Classes
    ResourceInstances
  8. implicit def catsEffectMonadForResource[F[_]](implicit F0: Monad[F]): Monad[[β$1$]Resource[F, β$1$]]

    Permalink
    Definition Classes
    ResourceInstances0
  9. implicit def catsEffectMonoidForResource[F[_], A](implicit F0: Monad[F], A0: Monoid[A]): Monoid[Resource[F, A]]

    Permalink
    Definition Classes
    ResourceInstances
  10. implicit def catsEffectSemigroupForResource[F[_], A](implicit F0: Monad[F], A0: Semigroup[A]): ResourceSemigroup[F, A]

    Permalink
    Definition Classes
    ResourceInstances0
  11. implicit def catsEffectSemigroupKForResource[F[_], A](implicit F0: Monad[F], K0: SemigroupK[F]): ResourceSemigroupK[F]

    Permalink
    Definition Classes
    ResourceInstances0
  12. def clone(): AnyRef

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

    Permalink
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def fromAutoCloseable[F[_], A <: AutoCloseable](acquire: F[A])(implicit F: Sync[F]): Resource[F, A]

    Permalink

    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))
      })
    F

    the type of the effect

    A

    the type of the autocloseable resource

    acquire

    The effect with the resource to acquire.

    F

    the effect type in which the resource was acquired and will be released

    returns

    a Resource that will automatically close after use

  17. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  18. def hashCode(): Int

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

    Permalink
    Definition Classes
    Any
  20. def liftF[F[_], A](fa: F[A])(implicit F: Applicative[F]): Resource[F, A]

    Permalink

    Lifts an applicative into a resource.

    Lifts an applicative into a resource. The resource has a no-op release.

    fa

    the value to lift into a resource

  21. def make[F[_], A](acquire: F[A])(release: (A) ⇒ F[Unit])(implicit F: Functor[F]): Resource[F, A]

    Permalink

    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.

    F

    the effect type in which the resource is acquired and released

    A

    the type of the resource

    acquire

    a function to effectfully acquire a resource

    release

    a function to effectfully release the resource returned by acquire

  22. def makeCase[F[_], A](acquire: F[A])(release: (A, ExitCase[Throwable]) ⇒ F[Unit])(implicit F: Functor[F]): Resource[F, A]

    Permalink

    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.

    F

    the effect type in which the resource is acquired and released

    A

    the type of the resource

    acquire

    a function to effectfully acquire a resource

    release

    a function to effectfully release the resource returned by acquire

  23. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  26. def pure[F[_], A](a: A)(implicit F: Applicative[F]): Resource[F, A]

    Permalink

    Lifts a pure value into a resource.

    Lifts a pure value into a resource. The resouce has a no-op release.

    a

    the value to lift into a resource

  27. def suspend[F[_], A](fr: F[Resource[F, A]]): Resource[F, A]

    Permalink

    Given a Resource suspended in F[_], lifts it in the Resource context.

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

    Permalink
    Definition Classes
    AnyRef
  29. def tailRecM[F[_], A, B](a: A)(f: (A) ⇒ Resource[F, Either[A, B]])(implicit F: Monad[F]): Resource[F, B]

    Permalink

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

  30. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  31. final def wait(): Unit

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

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

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

Inherited from ResourceInstances

Inherited from ResourceInstances0

Inherited from AnyRef

Inherited from Any

Ungrouped