April 2017
Intermediate to advanced
316 pages
9h 33m
English
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) } }
Read now
Unlock full access