It would be great, if there were support for using Resource with cats-effect-cps. Could look something like this
import cats.effect.cps._
async[IO] {
val results1 = talkToServer("request1", None).await
IO.sleep(100.millis).await
// openResource: (String, Option[Data]) => Resource[IO, Data]
val results2 = openResource("request2", Some(results1.data)).awaitResource
if (results2.isOK) {
writeToFile(results2.data).await
IO.println("done!").await
true
} else {
IO.println("abort abort abort").await
false
}
}
awaitResource is pretty bad name for this, but can't think of anything better at the moment. Over at dotty-cps-async, I recommended ! for IO and ~ for Resource: dotty-cps-async/dotty-cps-async#43 (comment)
The motivation is that using Resource is a bit unergonomic, especially if there are many of them, because it requires the programmer to nest the blocks in use.

Related discussion about Resource at dotty-cps-async/cps-async-connect#2 (comment)
/cc @rssh
It would be great, if there were support for using
Resourcewithcats-effect-cps. Could look something like thisawaitResourceis pretty bad name for this, but can't think of anything better at the moment. Over at dotty-cps-async, I recommended!for IO and~for Resource: dotty-cps-async/dotty-cps-async#43 (comment)The motivation is that using Resource is a bit unergonomic, especially if there are many of them, because it requires the programmer to nest the blocks in

use.Related discussion about Resource at dotty-cps-async/cps-async-connect#2 (comment)
/cc @rssh