Hi! I have a data class that I’m generating optics...
# arrow
z
Hi! I have a data class that I’m generating optics on like this. But I’m finding that I now need to add a lot more constructor params to it. So I’m hitting the error “Iso generation is supported for data classes with up to 22 constructor parameters.” What’s the quickest way around this? Is there a way to tell arrow to ignore some params?
Am I stuck manually writing the Lenses for just the params I want?
s
Hey Zach, Oh that’s a large amount of properties. If you don’t need ISO you can also manually specify which targets you want generated. So if you don’t need ISO for data classes with more than 22 params you can just target Lens
So if you just want to generate lenses you can use
@optics([Lens])
🤪 1
mind blown 1
This avoids generating
Iso
which is only possible up to 22 parameters, because in Arrow we had tuple3-22 on top of
Pair
. If tuples ever make it into the language then we could do this for N params, but currently we’re limited by the explicitly defined tuples.
👍 1
z
yes, it is a lot unfortunately and I’ll try to refactor later, but I’m in a hurry right now 🙂 I’ll give this a shot. Thank you!
👍 1
m
Hmm, did Kotlin copy the old 22 limit in Scala?
s
No, Arrow did. Kotlin only has arity-2 & 3. There is proper support for tupling on the roadmpa