@@ -18,23 +18,6 @@ import scala.language.implicitConversions
1818 * combinations with static type checking, making them ideal for configuration, data transformation, and API integrations where the shape
1919 * of data needs to be flexible but still type-safe.
2020 *
21- * =Record vs Row=
22- * Record and [[Row ]] both provide type-safe named fields, but represent different abstractions:
23- *
24- * '''Record''' is a '''labeled set''' — fields are unordered, a record with more fields can be used where fewer are expected (structural
25- * subtyping), and the same name can appear with different types. Use Record when different consumers need different field subsets or when
26- * composing fields from multiple sources.
27- *
28- * '''Row''' is a '''labeled sequence''' — fields have a fixed order, each name is unique, and the type must match exactly. Use Row when
29- * field order matters, when you need positional operations (head/tail/take/drop), or when working with case classes.
30- *
31- * The two interconvert freely:
32- * {{{
33- * val record = "name" ~ "Alice" & "age" ~ 30
34- * val row = Row.fromRecord(record) // Record -> Row (rejects duplicate field names)
35- * val back = row.toRecord // Row -> Record
36- * }}}
37- *
3821 * =Creation=
3922 * Records can be created through direct field construction using the `~` operator and combined with `&`:
4023 * {{{
@@ -183,6 +166,10 @@ object Record:
183166 case (n *: EmptyTuple , v *: EmptyTuple ) => n ~ v
184167 case (n *: ns, v *: vs) => (n ~ v) & FieldsOf [ns, vs]
185168
169+ type FieldValues [T <: Tuple ] <: Tuple = T match
170+ case EmptyTuple => EmptyTuple
171+ case Record .`~`[n, v] *: rest => v *: FieldValues [rest]
172+
186173 type ZipLookup [N <: String , T <: Tuple ] = T match
187174 case (N ~ v) *: _ => v
188175 case _ *: rest => ZipLookup [N , rest]
@@ -196,11 +183,6 @@ object Record:
196183 */
197184 def fromProduct [A ](value : A )(using ar : AsRecord [A ]): Record [ar.Fields ] = ar.asRecord(value)
198185
199- /** Creates a Record from a Row.
200- */
201- inline def fromRow [A <: NamedTuple .AnyNamedTuple ](row : Row [A ]): Record [Row .ToRecordFields [Row .Names [A ], Row .Values [A ]]] =
202- row.toRecord
203-
204186 /** A field in a Record, containing a name and associated type information.
205187 *
206188 * @param name
@@ -217,8 +199,8 @@ object Record:
217199 inline def fields (using ti : TypeIntersection [Fields ]): List [String ] =
218200 collectFieldNames[ti.AsTuple ]
219201
220- inline def values (using ti : TypeIntersection [Fields ]): Row . FieldValues [ti.AsTuple ] =
221- collectValues[ti.AsTuple ](self.toMap).asInstanceOf [Row . FieldValues [ti.AsTuple ]]
202+ inline def values (using ti : TypeIntersection [Fields ]): FieldValues [ti.AsTuple ] =
203+ collectValues[ti.AsTuple ](self.toMap).asInstanceOf [FieldValues [ti.AsTuple ]]
222204
223205 def update [Name <: String & Singleton , Value ](name : Name , value : Value )(using
224206 @ implicitNotFound("""
0 commit comments