Define default import

How can I determine the default import by default? I want to define package p so that

 import p._ 

equivalently

 import scala.util.Try import scala.collection.mutable.Queue 
+7
scala
source share
1 answer

Follow the pattern used in scala / package.scala to make part of the standard collection available without importing. It includes a package object with 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 } 
+8
source share

All Articles