Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mateuszkubuszok/explain-given

Preview how your implicits/givens got resolved on Scala 3
https://github.com/mateuszkubuszok/explain-given

debugging given implicit scala scala-3

Last synced: 15 days ago
JSON representation

Preview how your implicits/givens got resolved on Scala 3

Awesome Lists containing this project

README

        

# Explain given

Prints the `given` that was resolved in a method which expects `using`.

```scala
//> using scala 3.3.3
//> using dep com.kubuszok::explain-given:0.1.0
//> using dep io.circe::circe-generic::0.14.9

case class Foo(a: Int, b: String)
case class Bar(list: List[Foo])

import com.kubuszok.explain_given.ExplainGiven
import io.circe.*, io.circe.generic.auto.*, io.circe.syntax.*

// both compile time hint as well as runtime println
Bar(List(Foo(10, "test"))).asJson(ExplainGiven.apply)
// compile time hint only
Bar(List(Foo(10, "test"))).asJson(ExplainGiven.withHint)
// println only (runtime)
Bar(List(Foo(10, "test"))).asJson(ExplainGiven.withPrintln)
```

![screenshot](/screenshot.png)