Hi! I have a certain dificulty with optics which is illustrated by example:
interface HasAge { val age: Int }
@optics
data class Form(
override val age: Int
): HasAge {
companion object
}
// is exported out of the current "module"
val lens: Lens<HasAge, Int> = Form.age // compilation error
// in another module
fun transformAge(form: HasAge, lens: Lens<HasAge, Int>)
Can i somehow generate lens so that it can be assignable in the
val lens
line?
Very likely that all this trouble points to the wrong design on my part, but the thing is that full type information is lost between the modules, I cannot export full
data class Form
to be accessible to another module, all I've got is
Any
which I can cast to
HasAge
and then I thought I'd apply the lens (which also can be exported).