Skip to content

Commit 5ea80ef

Browse files
Add toList method to Tuple
Usually you do not want to work with Arrays when doing typeclass derivation, you want Lists. Currently the only way to get a List from a Tuple is `toArray.toList`, which is cumbersome.
1 parent de75713 commit 5ea80ef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/src/scala/Tuple.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ sealed trait Tuple extends Product {
1111
inline def toArray: Array[Object] =
1212
scala.runtime.Tuple.toArray(this)
1313

14+
/** Create a copy this tuple as a List */
15+
inline def toList: List[Object] =
16+
toArray.toList
17+
1418
/** Create a copy this tuple as an IArray */
1519
inline def toIArray: IArray[Object] =
1620
scala.runtime.Tuple.toIArray(this)

0 commit comments

Comments
 (0)