diff --git a/library/src/scala/NamedTuple.scala b/library/src/scala/NamedTuple.scala index 4a9d2b9f13d8..21c4c6840f5c 100644 --- a/library/src/scala/NamedTuple.scala +++ b/library/src/scala/NamedTuple.scala @@ -30,7 +30,7 @@ object NamedTuple: export NamedTupleDecomposition.{ Names, DropNames, - apply, size, init, last, tail, take, drop, splitAt, ++, map, reverse, zip, toList, toArray, toIArray + apply, size, init, head, last, tail, take, drop, splitAt, ++, map, reverse, zip, toList, toArray, toIArray } extension [N <: Tuple, V <: Tuple](x: NamedTuple[N, V]) @@ -43,9 +43,6 @@ object NamedTuple: // and should be reverted, just like NonEmptyList is also appealing at first, but a bad idea // in the end. - /** The first element value of this tuple */ - inline def head: Tuple.Elem[V, 0] = x.apply(0) - // inline def :* [L] (x: L): NamedTuple[Append[N, ???], Append[V, L] = ??? // inline def *: [H] (x: H): NamedTuple[??? *: N], H *: V] = ??? @@ -149,6 +146,9 @@ object NamedTupleDecomposition: /** The number of elements in this tuple */ inline def size: Tuple.Size[V] = x.toTuple.size + /** The first element value of this tuple */ + inline def head: Tuple.Elem[V, 0] = apply(0) + /** The last element value of this tuple */ inline def last: Tuple.Last[V] = apply(size - 1).asInstanceOf[Tuple.Last[V]]