Skip to content

Instantly share code, notes, and snippets.

@sjrd
Created March 22, 2017 12:54
Show Gist options
  • Save sjrd/ccc2ec61a2ccbae1eb4ee9dea004b7a5 to your computer and use it in GitHub Desktop.
Save sjrd/ccc2ec61a2ccbae1eb4ee9dea004b7a5 to your computer and use it in GitHub Desktop.
Compat code for parallel collections across 2.10/2.11/2.12 and 2.13
sbt.version=0.13.13
crossScalaVersions in ThisBuild := Seq("2.11.8", "2.12.1", "++2.13.0-pre-e2a2cba")
resolvers in ThisBuild += "scala-integration" at "https://scala-ci.typesafe.com/artifactory/scala-integration/"
scalaVersion in ThisBuild := "2.13.0-pre-e2a2cba"
libraryDependencies ++= {
if (scalaVersion.value.startsWith("2.13."))
Seq("org.scala-lang.modules" %% "scala-parallel-collections" % "0.1.1")
else
Seq()
}
package test
private[test] object CompatParColls {
val Converters = {
import Compat._
{
import scala.collection.parallel._
CollectionConverters
}
}
object Compat {
object CollectionConverters
}
}
package test
import test.CompatParColls.Converters._
object Main {
def main(args: Array[String]): Unit = {
val argsInt = args.par.map(_.toInt)
argsInt.foreach(println(_))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment