calico
calico copied to clipboard
Type inference for keyed `children` modifier
Really interesting ideas from @kubukoz:
type ElemOfS[A] =
A match {
case fs2.Stream[_, a] => a
}
type ElemOfL[A] =
A match {
case List[a] => a
}
children[ElemOfL[ElemOfS[stream.type]]] <-- stream
Another idea we discussed, for posterity:
case class Data(id: Int, text: String)
val stream: Stream[IO, List[Data]]
children <-- stream.map {
_.map(data => data.id -> div(data.text))
}
Ah yes, I think I serialized that in https://github.com/armanbilge/calico/issues/85 :)