Last active
December 18, 2016 06:49
-
-
Save ukitaka/b1d6c827b9f728a0e9ecac72c0adfc3e to your computer and use it in GitHub Desktop.
HList
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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