typelift / Swiftx

Functional data types and functions for any project
BSD 3-Clause "New" or "Revised" License
219 stars 28 forks source link

Updating <*> #43

Closed mpurland closed 9 years ago

mpurland commented 9 years ago

Original:

public func <*> <A, B>(f : (A -> B)?, a : A?) -> B? {
    return f.flatMap({ a.map($0) })
 }

What do you think about updating it so that it uses <^>?

New:

public func <*> <A, B>(f : (A -> B)?, a : A?) -> B? {
    return f.flatMap { $0 <^> a }
 }
CodaFi commented 9 years ago

That is much cleaner. Submit this as a pull request, please.

mpurland commented 9 years ago

@CodaFi Done :+1: , See #44