Created
October 15, 2017 10:09
-
-
Save soxjke/6c2dff8a8c255ff386f3c325d09300cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import Foundation | |
func work<R, T0>(_ f: @escaping (T0) -> R) -> (T0) -> R { | |
return { (arg0: T0) -> R in return f(arg0) } | |
} | |
func work<R, T0, T1>(_ f: @escaping (T0, T1) -> R) -> (T0, T1) -> R { | |
return { (arg0: T0, arg1: T1) -> R in return f(arg0, arg1) } | |
} | |
func test1(_ arg0: Int) -> Int { return arg0 } | |
func test2(_ arg0: Int, arg1: Int) -> Int { return arg0 + arg1 } | |
let a = work(test1) | |
let b = work(test2) // error: SwiftOverloads.playground:11:9: error: ambiguous use of 'work' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works with labels, but ...