flatMap
??
extension Optional { func merge(with other: Optional, f: (Wrapped, Wrapped) -> Wrapped) -> Optional { if let x = self, let y = other { return .some(f(x, y)) } else { return self ?? other } } }