Alternative to import java.lang._, scala._, scala.Predef._
. Prelude is a subset of the default imports, meaning that any code compiled under -Yno-imports
& import prelude._
should also compile with the default scalac configuration.
scalacOptions in ThisBuild +=
"-Yno-imports"
libraryDependencies +=
"in.nvilla" %%% "prelude" % "latest.integration"
import prelude._
-
Update
build.sbt
-
Add a prelude import after the first empty line of each
.scala
file:git ls-files | grep -e '.scala$' |\ while read file; do if ! grep -q "import prelude._" "$file"; then sed -i.class '1,/^$/ {/^$/aimport prelude._ }' "$file" fi done
-
Explicitly import what your project uses
scala._
andscala.Predef._
:git ls-files | grep -e '.scala$' |\ while read file; do for import in \ "import scala.collection.immutable.Seq" \ "import scala.collection.immutable.Set" \ "import scala.collection.immutable.Map" \ ; do # ^ Add imports as needed class=$(echo $import | rev | cut -d "." -f1 | rev) if grep -q "$class" "$file" && ! grep -q "$import" "$file"; then sed -i.class '1,/^$/ {/^$/a'"$import"' }' "$file" fi done done