DZone

Introduction

This post was inspired by a StackOverflow answer for the question Compose Futures with Recovery in Scala: Is it possible to compose Futures in a manner where, if one of them fails, a previous Future‘s execution result will be rolled back via some function?

The Problem

The case with Future can be generalized to some effect F[_], so we can say: How can we compose effects F[_] in a manner where, if one of them fails, the previous F[_] execution result will be rolled back via some function? This behavior is similar to what we know as a Transaction.

Source: DZone