Skip to content
simple future facade for Scala
Find file
Latest commit 0899506 @eed3si9n ls
Failed to load latest commit information.
notes 0.1.1
project ls
sff4s-actors/src ls
sff4s-akka/src ls
sff4s-api/src ls
sff4s-juc/src ls
sff4s-twitter-util/src ls
LICENSE fixed error handling 0.1.0


sff4s (simple future facade for Scala) is a Scala wrapper around several future implementations.

libraryDependencies ++= Seq(
  "com.eed3si9n" %% "sff4s-api" % "0.1.0",
  "com.eed3si9n" %% "sff4s-juc" % "0.1.0")

The API mostly mimics that of twitter util's Future:

val factory = sff4s.impl.ActorsFuture
val f = factory future {
val g = f map { _ + 1 }
g(2000) // => This blocks for the futures result (and eventually returns 2)

// Another option:
g onSuccess { value =>
  println(value) // => prints "2"

// Using for expressions:
val xFuture = factory future {1}
val yFuture = factory future {2}

for {
  x <- xFuture
  y <- yFuture
} {
  println(x + y) // => prints "3"

// Using implicit conversion
import factory._
val native = scala.actors.Futures future {5}
val w: sff4s.Future[Int] = native
w() // => This blocks for the futures result (and eventually returns 5)


Platform independent API consisting of abstract class Future[+A], which represents a future value; and trait Futures, which represents the dispatcher to create the future values.


Wrapper around scala.actors.Future.


Wrapper around java.util.concurrent.Future.


Wrapper around akka.dispatch.Future.


Wrapper around com.twitter.util.Future. Note unlike other implementation, TwitterUtilFuture.future does not process the calculation in the background. Instead, you're supposed to create a Promise object and set the value using your own concurrency mechanism.

Something went wrong with that request. Please try again.