scala context-abstractions

given in a namespace can also be imported into another namespace.

object A:
  given a: Int = 2
  given b: Char = 'A'
 
object B:
  def main(args: Array[String]): Unit =
    import A.given
    println(summon[Int]) // 2
    println(summon[Char]) // 'A'
 

A.given only imports given declarations.

References

  1. Importing givens in Scala 3