Swiftpack.co - YusukeHosonuma/SHList as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by YusukeHosonuma.
YusukeHosonuma/SHList 0.1.0
HList for Swift by statically meta-programming.
⭐️ 3
🕓 3 weeks ago
.package(url: "https://github.com/YusukeHosonuma/SHList.git", from: "0.1.0")

SHList

CocoaPods SPM Compatible License Twitter

SHList is HList for Swift by statically meta-programming.

Screenshot

let list = HList("Hello", 42, true)

list.head           // => "Hello"
list.tail.head      // => 42
list.tail.tail.head // => true

list.count           // => 3
list.tail.count      // => 2
list.tail.tail.count // => 2

list.asArray() // => ["Hello", 42, true] as [Any]

func f(a1: String, a2: Int, a3: Bool) -> String {
    "\(a1),\(a2),\(a3)"
}

list.apply(f) // => "Hello,42,true"

Limitation

Only up to 20 elements are supported.

Author

Yusuke Hosonuma / tobi462@gmail.com / @tobi462

License

SHList is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 3
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Related Packages

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics