[swift-users] Strange Behavior With Closures
bwm003 at gmail.com
bwm003 at gmail.com
Wed May 4 20:19:51 CDT 2016
Hi Everyone,
I was playing around in Xcode 7.3 with this code...
*/***
* * Represents a future value of type U, from a computation that has not
been done yet.*
* */*
*public struct Promise<T, U> {*
* var futureValue: T -> U*
* public func then<T,U,V>(closure: U -> V) -> Promise<T, V> {*
* return Promise<T, V>(futureValue: {*
* input in*
* let value = futureValue(input)*
* return closure(value)*
* })*
* }*
*}*
and came across the following error:
*error: cannot invoke value of type 'T -> U' with argument list '((T))'*
Can someone explain what is going on here? It looks like my closure should
be accepting a value of T, but for some reason the types aren't matching up.
Thanks, Blake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160505/f545301b/attachment.html>
More information about the swift-users
mailing list