A good approach to understand how promises work is to look at a possible, but extremely simplified implementation. So, we could start with something like the following to represent our results and errors, and our generic callbacks:
public enum Result<Value> { case success(Value) case failure(Error)}enum SimpleError: Error { case errorCause1 case errorCause2}typealias Callback<T> = (Result<T>) -> Void