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

The <*> operator is used to conditionally apply the other parameters to our curried init method. The definition is as follows:

public func <*> <T, U>(f: Decoded<(T) -> U>, x: Decoded<T>) -> Decoded<U> {     return x.apply(f) } func apply<U>(_ f: Decoded<(T) -> U>) -> Decoded<U> {     switch (f, self) {     case let (.success(function), _): return self.map(function)     case let (.failure(le), .failure(re)): return .failure(le + re)     case let (.failure(f), _): return .failure(f)     } } 

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