Skip to content

Instantly share code, notes, and snippets.

@jto
Last active June 5, 2016 14:56
Show Gist options
  • Save jto/76eed467a8ae2d3332ca to your computer and use it in GitHub Desktop.
Save jto/76eed467a8ae2d3332ca to your computer and use it in GitHub Desktop.
import scalaz._
import Scalaz._
import scala.concurrent.Future
import scalaz.std.scalaFuture._
import play.api.libs.concurrent.Execution.Implicits._
val f1 = (s: String) => Option("foo").point[Future]
def f2 = (s: String) => Option(1).point[Future]
type OptionTFuture[T] = OptionT[Future, T]
for {
e1 <- Kleisli(f1).mapK[OptionTFuture, String](OptionT.apply _)
e2 <- Kleisli(f2).mapK[OptionTFuture, String](OptionT.apply _)
} yield e1 + e2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment