ZIO
Example Links
To use Tyrian with ZIO, we need to bring in the tyrian-zio library.
ivy"io.indigoengine::tyrian-zio::x.y.z" // Mill
libraryDependencies += "io.indigoengine" %%% "tyrian-zio" % "x.y.z" // SBT
Then we can bring in the TyrianZIOApp
trait to create our application.
@JSExportTopLevel("TyrianApp")
object Main extends TyrianZIOApp[Msg, Model]:
Cmd
s and Sub
s then make use of ZIO's Task
type to perform side effects.
def update(model: Model): Msg => (Model, Cmd[Task, Msg]) =
case Msg.Increment => (model + 1, Cmd.None)
case Msg.Decrement => (model - 1, Cmd.None)
case Msg.NoOp => (model, Cmd.None)
def subscriptions(model: Model): Sub[Task, Msg] =
Sub.None