Can I import from multiple packages all at once in Scala?

You can do it easily if all imports you needed are members of some traits. If you have several traits with functions, inner classes etc. you can create object inherited from all of them. So all their stuff can be imported with simple import MyObject._. Importing class in this way became a bit tricky – you have to create a type member for each class.

For more examples of this technique see Casbah Imports object and Scalaz object in scalaz project.

Leave a Comment