daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Feb 24th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. enum Result<T> {
  2.  
  3.   case success(T)
  4.   case failure(Error)
  5.  
  6.   func map<A>(_ transform: (T) throws -> A) rethrows -> Result<A> {
  7.  
  8.     switch self {
  9.     case let .success(value):
  10.       return Result<A>.success(try transform(value))
  11.     case let .failure(error):
  12.       return Result<A>.failure(error)
  13.     }
  14.  
  15.   }
  16.  
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top