<^> 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)
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset