Skip to main content

Sequencing Operations

Declarative

val step1 = WIO.pure(MyState(1)).autoNamed
val step2 = WIO.pure(MyState(2)).autoNamed
val step3 = WIO.pure(MyState(3)).autoNamed

val sequence1 = step1 >>> step2 >>> step3
val sequence2 = step1.andThen(step2).andThen(step3)

Dynamic

val step1 = WIO.pure(MyState(1)).autoNamed
val step2 = WIO.pure(MyState(2)).autoNamed
val step3 = WIO.pure(MyState(3)).autoNamed

val sequence1 = for {
a <- step1
b <- step2
c <- step3
} yield c
val sequence2 = step1.flatMap(_ => step2).flatMap(_ => step3)