Created
October 5, 2014 04:16
-
-
Save jspahrsummers/ef5e64c18b9422673bdc to your computer and use it in GitHub Desktop.
Why does this use of SequenceType cause a compiler error? https://github.com/ReactiveCocoa/ReactiveCocoa/pull/1518
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
public static func fromSequence<S: SequenceType where S.Generator.Element == T>(sequence: S) -> Producer<T> { | |
return Producer { consumer in | |
for value in sequence { // error: cannot convert the expression's type 'S' to type 'S' | |
consumer.put(.Next(Box(value))) | |
} | |
consumer.put(.Completed) | |
} | |
} |
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
public static func fromSequence(sequence: SequenceOf<T>) -> Producer<T> { | |
return Producer { consumer in | |
for value in sequence { | |
consumer.put(.Next(Box(value))) | |
} | |
consumer.put(.Completed) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Was fighting this in
Set
just last night 😕