trait Basic[+F[_], A] extends Lifecycle[F, A]

A sub-trait of izumi.distage.model.definition.Lifecycle suitable for less-complex resource definitions via inheritance that do not require overriding izumi.distage.model.definition.Lifecycle#InnerResource.

final class BufferedReaderResource(
  file: File
) extends Lifecycle.Basic[IO, BufferedReader] {
  def acquire: IO[BufferedReader] = IO { new BufferedReader(new FileReader(file)) }
  def release(reader: BufferedReader): IO[BufferedReader] = IO { reader.close() }
}
Linear Supertypes
Lifecycle[F, A], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Basic
  2. Lifecycle
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. final type InnerResource = A
    Definition Classes
    BasicLifecycle

Abstract Value Members

  1. abstract def acquire: F[A]

    The action in F used to acquire the resource.

    The action in F used to acquire the resource.

    Definition Classes
    BasicLifecycle
    Note

    the acquire action is performed *uninterruptibly*, when F is an effect type that supports interruption/cancellation.

  2. abstract def release(resource: A): F[Unit]

    The action in F used to release, close or deallocate the resource after it has been acquired and used through izumi.distage.model.definition.Lifecycle.SyntaxUse#use.

    The action in F used to release, close or deallocate the resource after it has been acquired and used through izumi.distage.model.definition.Lifecycle.SyntaxUse#use.

    Definition Classes
    BasicLifecycle
    Note

    the release action is performed *uninterruptibly*, when F is an effect type that supports interruption/cancellation.

Concrete Value Members

  1. final def beforeAcquire[G[x] >: F[x]](f: => G[Unit])(implicit arg0: QuasiApplicative[G]): Lifecycle[G, A]
    Definition Classes
    Lifecycle
  2. final def beforeRelease[G[x] >: F[x]](f: (InnerResource) => G[Unit])(implicit arg0: QuasiApplicative[G]): Lifecycle[G, A]

    Prepend release action to existing

    Prepend release action to existing

    Definition Classes
    Lifecycle
  3. final def catchAll[G[x] >: F[x], B >: A](recover: (Throwable) => Lifecycle[G, B])(implicit arg0: QuasiIO[G]): Lifecycle[G, B]
    Definition Classes
    Lifecycle
  4. final def catchSome[G[x] >: F[x], B >: A](recover: PartialFunction[Throwable, Lifecycle[G, B]])(implicit arg0: QuasiIO[G]): Lifecycle[G, B]
    Definition Classes
    Lifecycle
  5. final def evalMap[G[x] >: F[x], B](f: (A) => G[B])(implicit arg0: QuasiPrimitives[G]): Lifecycle[G, B]
    Definition Classes
    Lifecycle
  6. final def evalTap[G[x] >: F[x]](f: (A) => G[Unit])(implicit arg0: QuasiPrimitives[G]): Lifecycle[G, A]
    Definition Classes
    Lifecycle
  7. final def extract[B >: A](resource: A): Right[Nothing, A]

    Either an action in F or a pure function used to extract the A from the InnerResource

    Either an action in F or a pure function used to extract the A from the InnerResource

    The effect in the Left branch will be performed *interruptibly*, it is not afforded the same kind of safety as acquire and release actions when F is an effect type that supports interruption/cancellation.

    When F is Identity, it doesn't matter whether the output is a Left or Right branch.

    When consuming the output of extract you can use _.fold(identity, F.pure) to convert the Either to F[B]

    Definition Classes
    BasicLifecycle
    See also

    Lifecycle.Basic extract doesn't have to be defined when inheriting from Lifecycle.Basic

  8. final def flatMap[G[x] >: F[x], B](f: (A) => Lifecycle[G, B])(implicit arg0: QuasiPrimitives[G]): Lifecycle[G, B]
    Definition Classes
    Lifecycle
  9. final def flatten[G[x] >: F[x], B](implicit arg0: QuasiPrimitives[G], ev: <:<[A, Lifecycle[G, B]]): Lifecycle[G, B]
    Definition Classes
    Lifecycle
  10. final def map[G[x] >: F[x], B](f: (A) => B)(implicit arg0: QuasiFunctor[G]): Lifecycle[G, B]
    Definition Classes
    Lifecycle
  11. final def redeem[G[x] >: F[x], B](onFailure: (Throwable) => Lifecycle[G, B], onSuccess: (A) => Lifecycle[G, B])(implicit arg0: QuasiIO[G]): Lifecycle[G, B]
    Definition Classes
    Lifecycle
  12. final def void[G[x] >: F[x]](implicit arg0: QuasiFunctor[G]): Lifecycle[G, Unit]
    Definition Classes
    Lifecycle
  13. final def widen[B >: A]: Lifecycle[F, B]
    Definition Classes
    Lifecycle
    Annotations
    @inline()
  14. final def widenF[G[x] >: F[x]]: Lifecycle[G, A]
    Definition Classes
    Lifecycle
    Annotations
    @inline()
  15. final def wrapAcquire[G[x] >: F[x]](f: (=> G[InnerResource]) => G[InnerResource]): Lifecycle[G, A]

    Wrap acquire action of this resource in another effect, e.g.

    Wrap acquire action of this resource in another effect, e.g. for logging purposes

    Definition Classes
    Lifecycle
  16. final def wrapRelease[G[x] >: F[x]](f: ((InnerResource) => G[Unit], InnerResource) => G[Unit]): Lifecycle[G, A]

    Wrap release action of this resource in another effect, e.g.

    Wrap release action of this resource in another effect, e.g. for logging purposes

    Definition Classes
    Lifecycle