Skip to content

Instantly share code, notes, and snippets.

View evgzakharov's full-sized avatar

Nerumb evgzakharov

View GitHub Profile

Proposal: "Hybrid Refinement Types"

(Compile-time validation where possible, runtime checks where necessary)

Concept:

Introduce refinement types that:

  1. Enforce constraints at compile time for literals and compile-time-known values.
  2. Generate runtime checks for dynamic values (e.g., variables computed at runtime).
  3. Integrate with Kotlin’s contracts and smart-casting to minimize boilerplate.

@evgzakharov
evgzakharov / gist:2f4a3a6fbcbc3ba81ff146d83a7fcd61
Last active October 22, 2019 08:27
Kotlin async-http-client integration
import io.netty.handler.codec.http.EmptyHttpHeaders
import io.netty.handler.codec.http.HttpHeaders
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.suspendCancellableCoroutine
import org.asynchttpclient.AsyncHandler
import org.asynchttpclient.AsyncHttpClient
import org.asynchttpclient.HttpResponseBodyPart
import org.asynchttpclient.HttpResponseStatus
import org.asynchttpclient.Request
import java.util.ArrayList
class GlobalCase {
fun someFun(): Unit {}
fun String.stringFun() {
}
}
fun main(args: Array<String>) {
val test: String = File("sadfasd").readText()