Last active
March 15, 2017 17:16
-
-
Save number23/d19040aa65907fbbc73c4f40e4d72230 to your computer and use it in GitHub Desktop.
scala lift
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
def lift[A, B, C, D](f: Function3[A, B, C, D]): Function3[Option[A], Option[B], Option[C], Option[D]] = | |
(oa: Option[A], ob: Option[B], oc: Option[C]) => | |
for (a <- oa; b <- ob; c <- oc) yield f(a, b, c) | |
def lift[A, B, C, D](f: (A, B, C) => D): (Option[A], Option[B], Option[C]) => Option[D] = | |
(oa: Option[A], ob: Option[B], oc: Option[C]) => | |
for (a <- oa; b <- ob; c <- oc) yield f(a, b, c) | |
val createConnection = lift(java.sql.DriverManager.getConnection) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment