Skip to content

Instantly share code, notes, and snippets.

@happy-bracket
Created February 18, 2020 17:12
Show Gist options
  • Save happy-bracket/8f545e2780163d1a03929d20af808331 to your computer and use it in GitHub Desktop.
Save happy-bracket/8f545e2780163d1a03929d20af808331 to your computer and use it in GitHub Desktop.
HList in Kotlin, but better!
sealed class HList {
object HNil : HList()
data class HNode<V, T : HList>(val value: V, val next: T) : HList()
data class HPlus<H1 : HList, H2 : HList>(val h1: H1, val h2: H2) : HList() // note this!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment