https://github.com/andyglow/scala-tuples
https://github.com/andyglow/scala-tuples
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/andyglow/scala-tuples
- Owner: andyglow
- Created: 2020-06-15T22:35:47.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-18T17:55:26.000Z (about 6 years ago)
- Last Synced: 2025-01-12T23:29:07.962Z (over 1 year ago)
- Language: Scala
- Size: 15.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Scala Tuple Extensions
Typesafe operations on tuples.
[](https://cloud.drone.io/andyglow/scala-tuples)
[](https://codecov.io/gh/andyglow/scala-tuples)
[](https://search.maven.org/search?q=g:%22com.github.andyglow%22%20AND%20a:%22scala-tuples_2.13%22)
- [x] prepend value `"abc" +: (1, false) == ("abc", 1, false)`
- [x] append value `(1, false) :+ "abc" == (1, false, "abc")`
- [x] concatenate `(1, false) :++ ("abc", 3.14) == (1, false, "abc", 3.14); (1, false) ++: ("abc", 3.14) == (1, false, "abc", 3.14)`
- [x] reverse `(1, 2, 3).reversed == (3, 2, 1)`
- [x] rotateRight `(1, 2, 3).rotatedRight == (3, 1, 2)`
- [x] rotateLeft `(1, 2, 3).rotatedLeft == (2, 3, 1)`
- [x] case class ToTuple
```
case class CC(a: Int, b: String, c: Float)
ToTuple(CC(1, "b", 3.14)) == (1, "b", 3.14)
```
So this is designed as less type-confusing analog of `CC.unapply(CC(1, "b", 3.14)).get`
- [x] case class FromTuple
```
case class CC(a: Int, b: String, c: Float)
FromTuple((1, "b", 3.14)).to[CC] == CC(1, "b", 3.14)
```
## Use
**SBT**
```
libraryDependencies += "com.andyglow.github" %% "scala-tuples" % "0.1.0"
```
**Maven**
```
com.github.andyglow
scala-tuples_2.13
0.1.0
```
**Gradle**
```
implementation 'com.github.andyglow:scala-tuples_2.13:0.1.0'
```