Remove the need to wrap every model in ZIO

This commit is contained in:
Paul-Henri Froidmont 2025-11-07 01:34:59 +01:00
parent 1da129f855
commit c19086ef32
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
6 changed files with 24 additions and 30 deletions

View file

@ -6,7 +6,7 @@ import zio.stream.ZStream
class ListLiveView(someParam: String) extends LiveView[Msg, Model]:
def init = ZIO.succeed(
def init =
Model(
elems = List(
NestedModel("a", 10),
@ -14,11 +14,10 @@ class ListLiveView(someParam: String) extends LiveView[Msg, Model]:
NestedModel("c", 20)
)
)
)
def update(model: Model) =
case Msg.IncAge(value) =>
ZIO.succeed(model.focus(_.elems.index(2).age).modify(_ + value))
model.focus(_.elems.index(2).age).modify(_ + value)
def view(model: Dyn[Model]) =
div(