Support multiple parameter lists for case classes
See original GitHub issueI’d like to derive a codec for
case class A(x:Int)(y:Int)
implicit val jsonCodec: JsonValueCodec[A] = JsonCodecMaker.make
but multiple parameter lists are not supported:
[error] 'A' hasn't a primary constructor with one parameter list. Please consider using a custom implicitly accessible codec for this type.
[error] L197: implicit val jsonCodec: JsonValueCodec[A] = JsonCodecMaker.make
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
How to pattern match a class with multiple argument lists?
Case classes match (and do their other nifty things) only on the first set of parameters: scala> case class A(i: Int)(j: Int) {...
Read more >Multiple parameter lists - Scala Programming Guidelines
Multiple parameter lists. Scala allows defining multiple parameter lists on methods and classes: def compare(x: Int)(y: Int): Int = x - y case...
Read more >Multiple Parameter Lists | Tour of Scala
Use cases. Suggested use cases for multiple parameter lists include: Drive type inference. It so happens that in Scala, type inference proceeds one...
Read more >Mirrors are not generated for Case Classes with multiple ...
For example when deriving a Decoder for a class with multiple parameter lists I want to be able to create an instance of...
Read more >Multiple Parameter Lists (Currying) - Scala - CWIKI.US
In case of a single functional parameter, like op in the case of foldLeft above, multiple parameter lists allow a concise syntax to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@fdietze @cornerman Here is a draft that supports primary constructors with multi-parameter lists: https://github.com/plokhotnyuk/jsoniter-scala/pull/905
Limitations for definitions are:
val
orvar
for parameters in non-first parameter listsFor sure your support and any help are welcome! Including GitHub stars and sponsoring 😉
@fdietze @cornerman Please peek a release with an initial support of multiple parameter lists in primary constructors: https://github.com/plokhotnyuk/jsoniter-scala/releases/tag/v2.13.29
Next steps will be refactoring of calculation of default values during parsing and adding support of default values for non-first parameter lists.