chimney icon indicating copy to clipboard operation
chimney copied to clipboard

Be able to convert from NonEmptyList[T] to Seq[T]

Open codesurf42 opened this issue 8 months ago • 5 comments

Describe the desired behavior I would like to have an option to convert data structures with more functional data types like cats.data.NonEmptyList[T] to scala.collection.immutable.Seq[T] (could be a case where this structure is generated by protobuf), so I don't need to write such specific conversions for every data type.

Having generic conversion like

  implicit def nelInvalidARE[T]: Transformer[cats.data.NonEmptyList[T], Seq[T]] =
    from => from.map(_.transformInto[T]).toList

in scope doesn't help.

Use case example "From" data type: class Foo(data: NonEmptyList[String])

"To" data type: class Bar(data: Seq[String])

How it relates to existing features There is a module for cats-related extensions, but it doesn't support such conversions.

Additional context I could help developing it and testing if I can get any more guidance with chimney.

codesurf42 avatar Oct 27 '23 08:10 codesurf42