All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.reader.kt Maven / Gradle / Ivy

Go to download

Provides fully-fledged multishot delimitied continuations in Kotlin with Coroutines

The newest version!
import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn

public suspend fun  Reader.ask(): T = suspendCoroutineUninterceptedOrReturn {
  findNearestSplitSeq(it).find(this)
}

public suspend fun  Reader.askOrNull(): T? = suspendCoroutineUninterceptedOrReturn {
  findNearestSplitSeq(it).findOrNull(this)
}

public suspend fun  runReader(value: T, fork: T.() -> T = { this }, body: suspend Reader.() -> R): R =
  with(Reader()) {
    pushReader(value, fork) { body() }
  }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy