Created
March 22, 2017 12:54
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sbt.version=0.13.13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
private[test] object CompatParColls { | |
val Converters = { | |
import Compat._ | |
{ | |
import scala.collection.parallel._ | |
CollectionConverters | |
} | |
} | |
object Compat { | |
object CollectionConverters | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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