u/The-_Captainin r/scala • Recommends
Why are effects better for retries than Future?
I am watching this great talk by Daniel Spiewak motivating effects. In particular, there is a point where he mentions that you can't do retries with Future, but you can with effects. Of course you literally can do retries with futures (e.g. here), but you risk repeating side-effects that aren't properly contained in a transaction. Why is this not the case for effects?
Example: say I want to log a statement then read a value from a database. In the case of a future retry, suppose the first attempt logs successfully then fails to read. The retry logs the statement again then reads from the database (successfully), resulting in two logs instea…