Note that the difference of FlatMapBack(FuncT, Res) from FlatMap(FuncT, Res) is in the return type; returns Res<T> rather than Res.
It appends back the original value to the result if the result was and is Ok after the map call.
static Res<Team> TryGetTeam() { .. } // tries to grab a team; might fail, hence, returns Res.
static Res TryPutTeam(Team team) { .. } // tries to put the team; might fail, hence, returns Res.
Res<Team> result = TryGetTeam().FlatMapBack(TryPutTeam);
// equivalently:
Res<Team> result = TryGetTeam().FlatMapBack(team => TryPutTeam(team));
// this is a shorthand for:
Res<Team> result = TryGetTeam() // Res<Team>
.FlatMap(team => TryPutTeam(team).Map(() => team)); // Res<Team>
public Task<Res<T>> FlatMapBackAsync(
Func<T, Task<Res>> map
)