macwire
macwire copied to clipboard
Lightweight and Nonintrusive Scala Dependency Injection Library
Would it be possible to add feature which would allow to resolve optional dependencies? Pseudo-implementation (which doesn't work): ```scala def wireOpt[T](enabled: Boolean): Option[T] = { if (enabled) { Some(wire[T]) }...
https://scastie.scala-lang.org/OlegYch/BlI4CHhuSGOBXIQdlRJcwg/2 ``` import com.softwaremill.macwire._ case class Config(redis: Int) case class B(redis: Int) trait MacWireComponents2 { def int: Int lazy val config = wire[Config] lazy val b = { val redis...
## Failing example (slightly realistic for motivation) This is vaguely what I want to do: ```scala import akka.actor.ActorSystem import akka.stream.{ActorMaterializer, Materializer} import com.softwaremill.macwire._ class MaterializerModule(actorSystem: ActorSystem) { implicit val materializer:...
I'm copying and pasting the tagging example from the docs into my IntelliJ Scratch file and I get a compiler error. I'm using Macwire 2.2.2 and Scala 2.11.8. ``` import...
building on the example of [multi-wiring via wireSet](https://github.com/adamw/macwire#multi-wiring-wireset) would it be possible to achieve this: ``` trait Musician class RockBand(musicians: Iterable[Musician]) class Singer extends Musician class Guitarist extends Musician class...
This is using macwire 0.7.1 and scala 2.11.2. When we have a code block like this: ``` /** * some comment what this service does. */ lazy val service: Service...
I'm [adding](https://github.com/retronym/scala/pull/28) compilation time tracing to `scalac` to show how long each file/class/method takes to typecheck. The trace drills down further to measure time spent in implicit searches and in...
The section on factories shows two alternatives on how to define a factory: ``` def taxCalculator(taxBase: Double) = wire[TaxCalculator] // or: lazy val taxCalculator = (taxBase: Double) => wire[TaxCalculator] ```...
The following does not compile: ```scala object Foo { trait Dep abstract class Abs { def foo: Dep } trait T { def bar: Dep } val d: Dep =...
I am new to Scala and Macwire and trying to figure out how to access instances that are wired using modules organized as classes. If modules are defined as traits,...