Added +(_:) operator to Failable<Numeric, T> type

This commit is contained in:
Caleb Kleveter 2018-11-28 14:59:53 -06:00
parent 2af5b08cfe
commit 7a59f94624
No known key found for this signature in database
GPG Key ID: B38DBD5CF2C98D69
1 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,11 @@ extension Failable where T: Numeric {
try lhs <~ lhs.value * rhs.value
}
/// See [`Numeric.+(_:)`]https://developer.apple.com/documentation/swift/numeric/2886206).
public static prefix func + (lhs: Failable<T, Validations>)throws -> Failable<T, Validations> {
return lhs
}
/// See [`Numeric.+(_:_:)`](https://developer.apple.com/documentation/swift/numeric/2884921).
public static func + (lhs: Failable<T, Validations>, rhs: Failable<T, Validations>)throws -> Failable<T, Validations> {
return try Failable(lhs.value + rhs.value)