object Lifecycle extends LifecycleInstances
- Alphabetic
- By Inheritance
- Lifecycle
- LifecycleInstances
- LifecycleCatsInstances
- LifecycleCatsInstancesLowPriority
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type AdaptFunctoid[A] = AdaptFunctoidImpl[A]
Support binding various FP libraries' Resource types in
.fromResource
- 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.
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() } }
- class FromAutoCloseable[+F[_], +A <: AutoCloseable] extends Of[[_]F[_], A]
Class-based variant of fromAutoCloseable:
Class-based variant of fromAutoCloseable:
class FileOutputRes extends Lifecycle.FromAutoCloseable( acquire = IO(new FileOutputStream("abc")) )
For binding resources using class syntax in ModuleDef:
val module = new ModuleDef { make[Int].fromResource[IntRes] }
- trait FromCats[F[_], A] extends Lifecycle[F, A]
- trait FromPair[F[_], A] extends Lifecycle[F, A]
- trait FromZIO[R, E, A] extends Lifecycle[[γ$8$]ZIO[R, E, γ$8$], A]
- type LifecycleTag[R] = LifecycleTagImpl[R]
- class LiftF[+F[_], A] extends NoCloseBase[F, A]
Class-based variant of liftF:
- class Make[+F[_], A] extends Basic[F, A]
Class-based variant of make:
- class MakePair[F[_], A] extends FromPair[F, A]
Class-based variant of makePair:
- class Make_[+F[_], A] extends Make[F, A]
Class-based variant of make_:
- trait Mutable[+A] extends Self[Identity, A]
- trait MutableNoClose[+A] extends SelfNoClose[Identity, A]
- trait MutableOf[+A] extends SelfOf[Identity, A]
- abstract class NoClose[+F[_], A] extends NoCloseBase[F, A] with Basic[F, A]
- abstract class NoCloseBase[+F[_], +A] extends Lifecycle[F, A]
- class Of[+F[_], +A] extends OfInner[F, A]
Class-based proxy over a Lifecycle value
Class-based proxy over a Lifecycle value
class IntRes extends Lifecycle.Of(Lifecycle.pure(1000))
For binding resource values using class syntax in ModuleDef:
val module = new ModuleDef { make[Int].fromResource[IntRes] }
- Note
when the expression passed to Lifecycle.Of defines many local methods it can hit a Scalac bug https://github.com/scala/bug/issues/11969 and fail to compile, in that case you may switch to Lifecycle.OfInner
- class OfCats[F[_], A] extends Of[F, A]
Class-based proxy over a cats.effect.Resource value
Class-based proxy over a cats.effect.Resource value
class IntRes extends Lifecycle.OfCats(Resource.pure(1000))
For binding resource values using class syntax in ModuleDef:
val module = new ModuleDef { make[Int].fromResource[IntRes] }
- trait OfInner[+F[_], +A] extends Lifecycle[F, A]
Trait-based proxy over a Lifecycle value
Trait-based proxy over a Lifecycle value
class IntRes extends Lifecycle.OfInner[IO, Int] { override val lifecycle: Lifecycle[IO, Int] = Lifecycle.pure(1000) }
For binding resource values using class syntax in ModuleDef:
val module = new ModuleDef { make[Int].fromResource[IntRes] }
- Note
This class may be used instead of Lifecycle.Of to workaround scalac bug https://github.com/scala/bug/issues/11969 when defining local methods
- class OfZIO[-R, +E, +A] extends Of[[γ$7$]ZIO[R, E, γ$7$], A]
Class-based proxy over a zio.ZManaged value
Class-based proxy over a zio.ZManaged value
class IntRes extends Lifecycle.OfZIO(Managed.succeed(1000))
For binding resource values using class syntax in ModuleDef:
val module = new ModuleDef { make[Int].fromResource[IntRes] }
- trait Self[+F[_], +A] extends Lifecycle[F, A]
- abstract class SelfNoClose[+F[_], +A] extends NoCloseBase[F, A]
- trait SelfOf[+F[_], +A] extends Lifecycle[F, A]
- trait Simple[A] extends Basic[Identity, A]
- implicit final class SyntaxLifecycleCats[+F[_], +A] extends AnyVal
- implicit final class SyntaxLifecycleIdentity[+A] extends AnyVal
- implicit final class SyntaxLifecycleMapK[+F[_], +A] extends AnyVal
- implicit final class SyntaxLifecycleZIO[-R, +E, +A] extends AnyVal
- implicit final class SyntaxLocatorRun[F[_]] extends AnyVal
- implicit final class SyntaxPure[F[_]] extends AnyVal
- implicit final class SyntaxUnsafeGet[F[_], A] extends AnyVal
- implicit final class SyntaxUse[F[_], +A] extends AnyVal
- implicit final class SyntaxUseEffect[F[_], A] extends AnyVal
- implicit final class SyntaxWidenError[F[+_, +_], +E, +A] extends AnyVal
- type TrifunctorHasLifecycleTag[R0, T] = TrifunctorHasLifecycleTagImpl[R0, T]
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
- lazy val AdaptFunctoid: AdaptFunctoidImpl.type
- lazy val LifecycleTag: LifecycleTagImpl.type
- lazy val TrifunctorHasLifecycleTag: TrifunctorHasLifecycleTagImpl.type
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- implicit final def catsFunctorForLifecycle[F[_], Functor[_[_]]](implicit arg0: cats.Functor[Functor], F: QuasiFunctor[F]): Functor[[β$26$]Lifecycle[F, β$26$]]
- Definition Classes
- LifecycleCatsInstancesLowPriority
- implicit final def catsMonadForLifecycle[Monad[_[_]], F[_]](implicit arg0: cats.Monad[Monad], F: QuasiPrimitives[F]): Monad[[β$23$]Lifecycle[F, β$23$]]
- Definition Classes
- LifecycleCatsInstances
- implicit final def catsMonoidForLifecycle[Monoid[_], F[_], A](implicit arg0: cats.kernel.Monoid[Monoid], F: QuasiPrimitives[F], A0: Monoid[A]): Monoid[Lifecycle[F, A]]
- Definition Classes
- LifecycleCatsInstances
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def fail[F[_], A](error: => Throwable)(implicit F: QuasiIO[F]): Lifecycle[F, A]
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def fork[F[+_, +_], E, A](f: F[E, A])(implicit arg0: Fork2[F]): Lifecycle[[β$0$]F[Nothing, β$0$], Fiber2[F, E, A]]
Fork the specified action into a new fiber.
Fork the specified action into a new fiber. When this
Lifecycle
is released, the fiber will be interrupted using izumi.functional.bio.Fiber2#interrupt- returns
The fiber running
f
action
- def forkCats[F[_], E, A](f: F[A])(implicit F: GenConcurrent[F, E]): Lifecycle[F, Fiber[F, E, A]]
Fork the specified action into a new fiber.
Fork the specified action into a new fiber. When this
Lifecycle
is released, the fiber will be interrupted using cats.effect.Fiber#cancel- returns
The fiber running
f
action
- def fork_[F[+_, +_], E, A](f: F[E, A])(implicit arg0: Fork2[F], arg1: Functor2[F]): Lifecycle[[β$1$]F[Nothing, β$1$], Unit]
- See also
- def fromAutoCloseable[A <: AutoCloseable](acquire: => A): Lifecycle[Identity, A]
- def fromAutoCloseable[F[_], A <: AutoCloseable](acquire: => F[A])(implicit F: QuasiIO[F]): Lifecycle[F, A]
- def fromCats[F[_], A](resource: Resource[F, A])(implicit F: Sync[F]): FromCats[F, A]
Convert cats.effect.Resource to Lifecycle
- def fromExecutorService[A <: ExecutorService](acquire: => A): Lifecycle[Identity, A]
- def fromExecutorService[F[_], A <: ExecutorService](acquire: => F[A])(implicit F: QuasiIO[F]): Lifecycle[F, A]
- def fromZIO[R, E, A](managed: ZManaged[R, E, A]): FromZIO[R, E, A]
Convert zio.ZManaged to Lifecycle
- implicit final def functor2ForLifecycle[F[+_, +_]](implicit arg0: Functor2[F]): Functor2[[+β$9$, +γ$10$]Lifecycle[[β$0$]F[β$9$, β$0$], γ$10$]]
- Definition Classes
- LifecycleInstances
- implicit final def functor3ForLifecycle[F[-_, +_, +_]](implicit arg0: Functor3[F]): Functor3[[-β$15$, +γ$16$, +δ$17$]Lifecycle[[γ$1$]F[β$15$, γ$16$, γ$1$], δ$17$]]
- Definition Classes
- LifecycleInstances
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def liftF[F[_], A](effect: => F[A])(implicit F: QuasiApplicative[F]): Lifecycle[F, A]
- effect
is performed interruptibly, unlike in make
- def make[F[_], A](acquire: => F[A])(release: (A) => F[Unit]): Lifecycle[F, A]
- def makePair[F[_], A](allocate: F[(A, F[Unit])]): Lifecycle[F, A]
- def makeSimple[A](acquire: => A)(release: (A) => Unit): Lifecycle[Identity, A]
- def make_[F[_], A](acquire: => F[A])(release: => F[Unit]): Lifecycle[F, A]
- 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()
- implicit final def providerFromCats[F[_], A](resource: => Resource[F, A])(implicit arg0: TagK[F], tag: Tag[FromCats[F, A]]): Functoid[FromCats[F, A]]
Allows you to bind cats.effect.Resource-based constructors in
ModuleDef
:Allows you to bind cats.effect.Resource-based constructors in
ModuleDef
:Example:
import cats.effect._ val catsResource = Resource.liftF(IO(5)) val module = new distage.ModuleDef { make[Int].fromResource(catsResource) }
- Note
binding a cats Resource[F, A] will add a dependency on
Sync[F]
for your correspondingF
type (Sync[F]
instance will generally be provided automatically via izumi.distage.modules.DefaultModule)
- implicit final def providerFromZIO[R, E, A](managed: => ZManaged[R, E, A])(implicit tag: Tag[FromZIO[R, E, A]]): Functoid[FromZIO[R, E, A]]
Allows you to bind zio.ZManaged-based constructors in
ModuleDef
: - implicit final def providerFromZIONothing[R, A](managed: => ZManaged[R, Nothing, A])(implicit tag: Tag[FromZIO[R, Nothing, A]]): Functoid[FromZIO[R, Nothing, A]]
Allows you to bind zio.ZManaged-based constructors in
ModuleDef
: - implicit final def providerFromZLayerHas1[R, E, A](layer: => ZLayer[R, E, Has[A]])(implicit arg0: Tag[A], tag: Tag[FromZIO[R, E, A]]): Functoid[FromZIO[R, E, A]]
Allows you to bind zio.ZLayer-based constructors in
ModuleDef
: - implicit final def providerFromZLayerNothingHas1[R, A](layer: => ZLayer[R, Nothing, Has[A]])(implicit arg0: Tag[A], tag: Tag[FromZIO[R, Nothing, A]]): Functoid[FromZIO[R, Nothing, A]]
Allows you to bind zio.ZLayer-based constructors in
ModuleDef
: - def pure[F[_]]: SyntaxPure[F]
- Annotations
- @inline()
- def suspend[F[_], A](effect: => F[Lifecycle[F, A]])(implicit arg0: QuasiPrimitives[F]): Lifecycle[F, A]
- effect
is performed interruptibly, unlike in make
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def traverse[F[_], A, B](l: Iterable[A])(f: (A) => Lifecycle[F, B])(implicit arg0: QuasiPrimitives[F]): Lifecycle[F, List[B]]
- def traverse_[F[_], A](l: Iterable[A])(f: (A) => Lifecycle[F, Unit])(implicit arg0: QuasiPrimitives[F]): Lifecycle[F, Unit]
- def unit[F[_]](implicit F: QuasiApplicative[F]): Lifecycle[F, Unit]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()