Created
February 25, 2015 16:29
-
-
Save amazari/5e99ddbb8f6aa81df2bd to your computer and use it in GitHub Desktop.
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
// Would love to use the following, sadly TypedPipe is not really monadic: | |
// * a bind/flatMap operator is missing: | |
// Indeed flatMap currently has the following signature: | |
// def flatMap[U](f: (T) ⇒ TraversableOnce[U]): TypedPipe[U] | |
// whereas a monadic bind would look like this | |
// def flatMap[U](f: (T) ⇒ TypedPipe[U]): TypedPipe[U] | |
// * return/unit can be implemented in such way: | |
// return[A]: A => TypedPipe[A] = a => TypedPipe.from(List(a)) | |
for { | |
user <- usersPipe | |
birthdate <- birthDatesPipe if ( birthDate.userId == user.id ) | |
present <- presentsPipe if ( present.userId == user.uid ) | |
} yield ((sale, birthDate, present)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment