Did anyone try implementing `get()` using Arrow Op...
# strikt
d
Did anyone try implementing
get()
using Arrow Optics? It might avoid a bunch of gets to drill down a hierarchy and
get { }
that inspects the source code itself...
One useful example would be:
Copy code
fun <R> Assertion.Builder<JsonElement>.getEvery(function: Every<JsonElement, R>): DescribeableBuilder<List<R>> {
        val result = function.getAll(this.subject)
        return get("Get from 'every' optic: $result") { result }
    }
But I'm sure it could be done better...
r
not to my knowledge, but that’s an interesting idea. I us Arrow lenses a lot at work, although I confess I find the rest of the library incomprehensible
d
The docs were redone and 1.2.0 is supposed to come out soon, the new docs are more comprehensible...