izumi.distage.model.definition.dsl
Members list
Concise view
Type members
Classlikes
trait AbstractBindingDefDSL[BindDSL[_], BindDSLAfterFrom[_], SetDSL[_]] extends AbstractBindingDefDSLMacro[BindDSL]
Attributes
- Companion:
- object
- Graph
- Supertypes
- Known subtypes
- Self type
object AbstractBindingDefDSL
Attributes
- Companion:
- trait
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
trait AnyKindShim
Attributes
- Companion:
- object
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- object AnyKindShim.typetrait LifecycleTagLowPriorityobject LifecycleTag.typeobject MakeDSLBase.typeclass MakeDSL[T]class MakeNamedDSL[T]object SetDSLBase.typetrait SetDSLMutBase[T]class MultiSetElementDSL[T]class SetDSL[T]class SetElementDSL[T]class SetNamedDSL[T]
Attributes
- Companion:
- trait
- Graph
- Supertypes
- Self type
- AnyKindShim.type
trait IncludesDSL
Attributes
- Companion:
- object
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
object IncludesDSL
Attributes
- Companion:
- trait
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- IncludesDSL.type
object LifecycleAdapters
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- LifecycleAdapters.type
Attributes
- Graph
- Supertypes
- Known subtypes
- object LifecycleTag.type
trait ModuleDefDSL extends AbstractBindingDefDSL[MakeDSL, MakeDSLUnnamedAfterFrom, SetDSL] with IncludesDSL with TagsDSL
DSL for defining module Bindings.
DSL for defining module Bindings.
Example:
class Program[F[_]: TagK: Monad] extends ModuleDef {
make[TaglessProgram[F]]
}
object TryInterpreters extends ModuleDef {
make[Validation.Handler[Try]].from(tryValidationHandler)
make[Interaction.Handler[Try]].from(tryInteractionHandler)
}
// Combine modules into a full program
val TryProgram = new Program[Try] ++ TryInterpreters
Singleton bindings:
make[X]
= create X using its constructormake[X].from[XImpl]
= bind X to its subtype XImpl using XImpl's constructormake[X].from(myX)
= bind X to an already existing instancemyX
make[X].from { y: Y => new X(y) }
= bind X to an instance of X constructed by a given Functoid requesting an Y parametermake[X].from { y: Y @Id("special") => new X(y) }
= bind X to an instance of X constructed by a given Functoid, requesting a named "special" Y parametermake[X].from { y: Y => new X(y) }
.annotateParameterY = bind X to an instance of X constructed by a given Functoid, requesting a named "special" Y parametermake[X].named("special")
= bind a named instance of X. It can then be summoned using Id annotation.make[X].using[X]("special")
= bind X to refer to another already bound named instance at key[X].named("special")
make[X].fromEffect(X.create[F]: F[X])
= create X using a purely-functional effectX.create
inF
monadmake[X].fromResource(X.resource[F]: Lifecycle[F, X])
= create X using aLifecycle
value specifying its creation and destruction lifecyclemake[X].from[XImpl].modify(fun(_))
= Create X using XImpl's constructor and applyfun
to the resultmake[X].from[XImpl].modifyBy(_.flatAp { (c: C, d: D) => (x: X) => c.method(x, d) })
= Create X using XImpl's constructor and modify itsFunctoid
using the provided lambda - in this case by summoning additionalC
&D
dependencies and applyingC.method
toX
Set bindings:
many[X].add[X1].add[X2]
= bind aSet
of X, and add subtypes X1 and X2 created via their constructors to it. Sets can be bound in multiple different modules. All the elements of the same set in different modules will be joined together.many[X].add(x1).add(x2)
= add instances x1 and x2 to aSet[X]
many[X].add { y: Y => new X1(y).add { y: Y => X2(y) }
= add instances of X1 and X2 constructed by a given Provider functionmany[X].named("special").add[X1]
= create a named set of X, all the elements of it are added to this named set.many[X].ref[XImpl]
= add a reference to an already existing binding of XImpl to a set of X'smany[X].ref[X]("special")
= add a reference to an existing named binding of X to a set of X's
Mutators:
modify[X](fun(_))
= add a modifier applyingfun
to the value bound atX
(mutator application order is unspecified)modify[X].by(_.flatAp { (c: C, d: D) => (x: X) => c.method(x, d) })
= add a modifier, applying the provided lambda to aFunctoid
retrievingX
- in this case by summoning additionalC
&D
dependencies and applyingC.method
toX
Tags:
make[X].tagged("t1", "t2)
= attach tags to X's binding.many[X].add[X1].tagged("x1tag")
= Tag a specific element of X. The tags of sets and their elements are separate.many[X].tagged("xsettag")
= Tag the binding of empty Set of X with a tag. The tags of sets and their elements are separate.
Includes:
include(that: ModuleDef)
= add all bindings inthat
module intothis
module
Attributes
- See also:
- Companion:
- object
- Graph
- Supertypes
- Known subtypes
- Self type
object ModuleDefDSL
Attributes
- Companion:
- trait
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- ModuleDefDSL.type
trait TagsDSL
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
Attributes
- Graph
- Supertypes