Yet another use case for type classes in the UI: ...
# arrow
s
Yet another use case for type classes in the UI:
Copy code
// in existed module
data class User(val name: String)

// in other module
object UserRenderer: Renderer<User> {
    fun User.render() = Row {
        +Column { +"Name: " }
        +Column { +name }        
    }
}

fun someOtherComponent(user: User)
  = Row { +user }
👏 1
e
HKT? Where?
s
Renderer here is higer kinded type
e
How come? It is just a generic type…
s
oh, sorry. I mean type class
fixed