Skip to content

Instantly share code, notes, and snippets.

View Atternatt's full-sized avatar

Marc Moreno Ferrer Atternatt

View GitHub Profile
//Does this compile?
inline fun <A, B> A.andThen(block: (A) -> Unit) {
Runnable {
block(this)
}
}
//region DSL
class ExecutionCancelationException(val failure: Any?) : RuntimeException()
interface ExecutionScope<in F> {
fun fail(f: F): Nothing = throw ExecutionCancelationException(f)
}
sealed interface Result<out F, out R>
data class Success<out R>(val result: R) : Result<Nothing, R>