O'Reilly logo

Swift Functional Programming - Second Edition by Dr. Fatih Nayebi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

<^> operator

Our first operator in the decoding process, <^>, is used to map our curried init method over a value. The definition is as follows:

public func <^> <T, U>(f: (T) -> U, x: Decoded<T>) -> Decoded<U> {     return x.map(f) } func map<U>(_ f: (T) -> U) -> Decoded<U> {     switch self {     case let .success(value): return .success(f(value))     case let .failure(error): return .failure(error)     } } 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required