Skip to content

Instantly share code, notes, and snippets.

@ukitaka
Last active December 18, 2016 06:49
Show Gist options
  • Select an option

  • Save ukitaka/b1d6c827b9f728a0e9ecac72c0adfc3e to your computer and use it in GitHub Desktop.

Select an option

Save ukitaka/b1d6c827b9f728a0e9ecac72c0adfc3e to your computer and use it in GitHub Desktop.
HList
protocol HList {
associatedtype Head
associatedtype Tail
}
struct HCons<H, T: HList>: HList {
typealias Head = H
typealias Tail = T
let head: H
let tail: T
init(_ head: H, _ tail: T) {
self.head = head
self.tail = tail
}
}
struct HNil: HList {
typealias Head = Never
typealias Tail = Never
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment