https://github.com/yusukehosonuma/shlist
HList for Swift by statically meta-programming.
https://github.com/yusukehosonuma/shlist
functional-programming hlist swift
Last synced: 4 months ago
JSON representation
HList for Swift by statically meta-programming.
- Host: GitHub
- URL: https://github.com/yusukehosonuma/shlist
- Owner: YusukeHosonuma
- License: mit
- Created: 2020-03-27T13:38:23.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-07-22T05:44:02.000Z (almost 3 years ago)
- Last Synced: 2025-01-16T19:34:56.440Z (4 months ago)
- Topics: functional-programming, hlist, swift
- Language: Swift
- Homepage:
- Size: 54.7 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SHList
[](https://cocoapods.org/pods/SHList)

[](https://github.com/YusukeHosonuma/SHList/blob/master/LICENSE)
[](https://twitter.com/tobi462)SHList is HList for Swift by statically meta-programming.

```swift
let list = HList("Hello", 42, true)list.head // => "Hello"
list.tail.head // => 42
list.tail.tail.head // => truelist.count // => 3
list.tail.count // => 2
list.tail.tail.count // => 2list.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 / [email protected] / [@tobi462](https://twitter.com/tobi462)
## License
[SHList](https://github.com/YusukeHosonuma/SHList) is available under the MIT license. See the LICENSE file for more info.