-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
When we get capture checked Gears it would be good that the following works as expected:
val good1: List[Future[Result[T]]] -> Future[Result[List[T]]] = frs =>
Future:
Result:
frs.map(_.await.ok)
val good2: Result[Future[T]] -> Future[Result[T]] = rf =>
Future:
Result:
rf.ok.await // OK, Future argument has type Result[T]On the other hand, the following case should fail:
val fail3: Future[Result[T]] -> Result[Future[T]] = fr =>
Result:
Future:
fr.await.ok // error, escaping label from ResultThis fails because it is expanded to
val fail3: Future[Result[T]] -> Result[Future[T]] = fr =>
Result: lbl ?=>
Future:
fr.await.ok(using lbl) // error, escaping label from Resultand the Future block has type Future[T]^{async, lbl}.
A transform having that type can be constructed but would be useless since we take a future of a value:
val useless4: Future[Result[T]] -> Result[Future[T]] = fr =>
fr.await.map(Future(_))The difference between good2 and fail3 is that Result is strict and Future is not.
Metadata
Metadata
Assignees
Labels
No labels