Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Implicit def for more comlex HLists of futures
implicit def hconsIsHListOfFutures[H, In <: HList, Out <: HList]
(implicit ev: IsHListOfFutures[In, Out]): IsHListOfFutures[Future[H] :: In, H :: Out] = new IsHListOfFutures[Future[H] :: In, H :: Out] {
override def hsequence(l : Future[H] :: In)(implicit ec: ExecutionContext): Future[H :: Out] = {
val head = l.head
val tail = l.tail
head.flatMap(h => ev.hsequence(tail).map(h :: _))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment