Skip to content

Instantly share code, notes, and snippets.

@rpiotrow
Last active October 12, 2019 18:40
Show Gist options
  • Save rpiotrow/f6003b08780a3ae943ad5f08a87ea440 to your computer and use it in GitHub Desktop.
Save rpiotrow/f6003b08780a3ae943ad5f08a87ea440 to your computer and use it in GitHub Desktop.
interface Suspendable<F> {
suspend fun <A: Any> Kind<F, A>.suspended(): A
}
fun IO.Companion.suspendable(): Suspendable<ForIO> = object: Suspendable<ForIO> {
override suspend fun <A : Any> Kind<ForIO, A>.suspended(): A {
val io = this.fix()
return io.suspended()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment