Higher order (or recursive?) generic type parameters in kotlin
I'm prototyping some highly declarative code, and the type inference and safety that comes with Kotlin helps a lot. One of the goals is making extensions (subclasses) of the primary types stupidly easy to implement. In order to maintain rich type inference and expressiveness, I've found some success in defining generic extension functions projected against subclasses. All the type information of subclass methods with none of the extra subclass implementation, it's great. So I'm trying to write a rich generic function that maintains as much type information as possible. The issue creeps up with