This file contains 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
# Requirement: the project must be on Scala 2.12.3 | |
# Step 1 - Add the scalafix sbt plugin | |
echo 'addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.5.0-M4")' >> projecs/plugins.sbt | |
# Step 2 (MANUAL) - Add the traneio Scala Future dependency to the sbt build | |
# resolvers += Resolver.sonatypeRepo("snapshots") | |
# libraryDependencies += "io.trane" % "future-scala" % "0.2.3-SNAPSHOT" | |
# Step 2 - Run the scalafix rewrite |
This file contains 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 fix | |
import scalafix._ | |
import scala.meta._ | |
case class ReplaceSymbols(sctx: SemanticCtx) extends SemanticRewrite(sctx) { | |
def rewrite(ctx: RewriteCtx): Patch = | |
ctx.replaceSymbols( | |
"scala.concurrent.Await" -> "io.trane.future.scala.Await", |
This file contains 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
t1.flatMap(a => t2.filter(b => b.s == a.s).map(b => b.s)) | |
SELECT t2.s FROM t1, t2 WHERE t2.s = t1.s | |
t1.flatMap(a => t2.map(b => b.s).take(10)) | |
SELECT x.s FROM t1, (SELECT * FROM t2 LIMIT 10) x | |
t1.flatMap(a => t2.filter(b => b.s == a.s).map(b => b.s).take(10)) |
This file contains 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
scala> class Bippy(xs: List[Int]) extends improving.TypesafeProxy(xs) { def isEmpty = true } | |
defined class Bippy | |
scala> val bippy = new Bippy(1 to 10 toList) | |
bippy: Bippy = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) | |
scala> bippy.slice(3, 7) | |
[proxy] $line4.$read.$iw.$iw.bippy.slice(3, 7) | |
res1: List[Int] = List(4, 5, 6, 7) |
This file contains 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
object Demo { | |
// A couple of type classes with type members ... | |
trait Foo[T] { | |
type A | |
} | |
object Foo { | |
implicit val fooIS = new Foo[Int] { type A = String } | |
} |
This file contains 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
[warn] The global sbt directory is now versioned and is located at /Users/flavio/.sbt/0.13. | |
[warn] You are seeing this warning because there is global configuration in /Users/flavio/.sbt but not in /Users/flavio/.sbt/0.13. | |
[warn] The global sbt directory may be changed via the sbt.global.base system property. | |
[info] Loading project definition from /Users/flavio/workspace/Activate_benchmark/project | |
[info] Set current project to Activate_benchmark (in build file:/Users/flavio/workspace/Activate_benchmark/) | |
> run | |
[info] Compiling 1 Scala source to /Users/flavio/workspace/Activate_benchmark/target/scala-2.11/classes... | |
[info] Running activate.ActivateBenchMark | |
09:27:43.191 [run-main-0] DEBUG org.reflections.Reflections - going to scan these urls: | |
file:/Users/flavio/workspace/Activate_benchmark/target/scala-2.11/classes/ |
This file contains 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
import scala.reflect.runtime.universe._ | |
object Main extends App { | |
trait SomeTrait | |
def doSomething[T: TypeTag] = | |
typeTag[T].tpe | |
val threads = List.fill(100) { |
This file contains 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
import scala.concurrent.ExecutionContext | |
import scala.concurrent.{ Future => ScalaFuture } | |
import scala.concurrent.{ Promise => ScalaPromise } | |
import scala.util.Failure | |
import scala.util.Success | |
import com.twitter.util.{ Future => TwitterFuture } | |
import com.twitter.util.{ Promise => TwitterPromise } | |
object FutureBridge { |
This file contains 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
localhost:FrameworkBenchmarks fwbrasil$ toolset/run-tests.py -u fwbrasil --test play-activate-mysql play-scala play-slick play-scala-mongodb -i /Users/fwbrasil/.ssh/id_rsa --max-threads 5 --max-concurrency 16 --duration 1 | |
WARNING:root:results.json for test ec2 not found. | |
===================================================== | |
Preparing Server, Database, and Client ... | |
===================================================== | |
bash: line 0: cd: /sys/devices/system/cpu: No such file or directory | |
ls: cpu*: No such file or directory | |
net: class is not implemented |
This file contains 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
===================================================== | |
Beginning play-scala-mongodb | |
----------------------------------------------------- | |
----------------------------------------------------- | |
Starting play-scala-mongodb | |
----------------------------------------------------- | |
sudo: no tty present and no askpass program specified |