Skip to main content

Running Side Effects

Without Error

val doThings: WIO[MyState, Nothing, MyState] =
WIO
.runIO[MyState](state => IO(MyEvent()))
.handleEvent((state, event) => MyState(state.counter + 1))
.autoNamed

With Error

val doThingsWithError: WIO[MyState, MyError, MyState] =
WIO
.runIO[MyState](state => IO(MyEvent()))
.handleEventWithError((state, event) =>
if (true) MyState(state.counter + 1).asRight
else MyError().asLeft,
)
.autoNamed
note

Errors render in flowchart only when they are handled