Last active
December 21, 2015 20:29
-
-
Save andyscott/6361691 to your computer and use it in GitHub Desktop.
sequencing List[Future[A \/ B]]
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
type FutureEither[A, B] = EitherT[Future, A, B] | |
implicit class SequenceOverFutureEither[F[_], A, B](v: F[FutureEither[A, B]])(implicit F0: Traverse[F]) { | |
def sequenceR() = v.sequence[({ type λ[R] = FutureEither[A, R] })#λ, B] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't see F0 used in the body there, so it seems you could also write that using "context bound" syntax, as
F[_] : Traverse
. And if you wanted to avoid that type lambda, you could specify it on a seperate line.Together, that would give you something that looked like:
Maybe I should just get more used to those type lambdas, though... :/