| ▲ | ndriscoll 7 hours ago | ||||||||||||||||
You can also use type inference with union types like ZIO. So you could e.g. return a Result where the error type is `DatabaseError | InvalidBirthdayError`. If you're in an error monad anyway, and you add a new error type deep in the call stack, it can just infer itself into the union up the stack to wherever you want to handle it. | |||||||||||||||||
| ▲ | skybrian 6 hours ago | parent [-] | ||||||||||||||||
That will help locally, but for a published API or a callback function where you don't know the callers, it's still going to break people if you change a union type. It doesn't matter if it's inferred or not. | |||||||||||||||||
| |||||||||||||||||