Q:

Define package-wide default imports

How can I define package-wide default imports? I want to define a package p such that
import p._

is equivalent to
import scala.util.Try
import scala.collection.mutable.Queue

A:

Follow the pattern used in scala/package.scala to make some of the standard collection available without imports. It involves a package object with a type and a val for each import:
package object p {
  type Try[A] = scala.util.Try[A]
  val Try = scala.util.Try
  type Queue[A] = scala.collection.mutable.Queue[A]
  val Queue = scala.collection.mutable.Queue
}

