Created
June 23, 2016 02:04
-
-
Save milesegan/8a1284e531700e28ad16d1a643a016e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Optional { | |
public func flatCall(@noescape f: (Wrapped) throws -> Void) rethrows -> Void { | |
switch self { | |
case .Some(let wrapped): | |
try f(wrapped) | |
case .None: | |
break | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment