calico icon indicating copy to clipboard operation
calico copied to clipboard

Type inference for keyed `children` modifier

Open armanbilge opened this issue 2 years ago • 2 comments

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

armanbilge avatar Sep 19 '22 18:09 armanbilge

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))
}

kubukoz avatar Sep 19 '22 18:09 kubukoz

Ah yes, I think I serialized that in https://github.com/armanbilge/calico/issues/85 :)

armanbilge avatar Sep 19 '22 18:09 armanbilge