-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Be able to convert from NonEmptyList[T] to Seq[T] #421
Comments
Just to be clear: you are missing the ability to just import existing implicits, rather than write your own? Because providing the implicit works. I'd say such thing is doable, but one would have to keep a few things in mind:
So all in all doable, but one has to be prepared for quite a bit of work |
Thank you for quick response. Yes, looks like it works for simple types and that's what I have already tried. Can you have a look while it doesn't work when T is a more complex type, like here: https://scastie.scala-lang.org/Q14e3vvvSuOLHvz227wyyQ
|
Yes, such implicit would have to take another implicit: https://scastie.scala-lang.org/MateuszKubuszok/sxNjTJcdTti8yio8g0CRYA - I added a section about it in docs, that would be published in 0.8.1 (read it together with recommended automatic vs semiautomatic, since there us quite an important things there about the type of the implicit). |
For me it works fine, so I don't feel like in need of this feature now. If I was to make chimney more user-friendly (and docs better searchable/gpt-ready), I would add the explicit example with smth like NonEmptyList[T] to the cookbook, especially there was the inner implicit auto-derived. I mean - not everyone will study all the docs before giving up on some library / such examples could attract more people to the user base. |
Well, I understand, but at the same time:
The release of a 0.8.x was a huge effort and I want to shift my attention to other things. I have some ideas what I also want to implement, but beyond that, if it's not a serious bug then I am leaving it at the hands of community. |
Released in 1.0.0-RC1 |
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
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.
The text was updated successfully, but these errors were encountered: