It works with Raise! All DSL from Arrow do! Including cancellation on Arrow Fx Coroutines, Saga, Resource, AutoClose, etc.
Small example:
either {
saga {
saga({ println("Action A") }) { println("Rollback A") }
raise("failed")
1
}.transact()
}
There is however a big difference between
either { saga { } }
or
saga { either { } }
. The first is a computation that can fail with
E
, which inside is using a
saga
. Since
Saga
sees
raise
as a failure, it will rollback
action A.
In the latter case, we have a
Saga
that computes an
Either
. So any
Left.bind
, or
raise
, that is encountered will not fail the
Saga
but would return
Either.Left
if
transact
is called on the
Saga
.
Hope that helps! I think we should probably add this example to the documentation βΊοΈ I find it really neat that all DSLs can be nested, and that depending on the order you can get different behavior.