Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize the type for sequence taking a dict #341

Merged
merged 1 commit into from
Apr 5, 2016

Conversation

gfontenot
Copy link
Collaborator

There wasn't actually any real reason to limit this to working on
[String: Decoded<T>] values. Instead, we should be able to use this
function with any key type.

Another change that came about because of having trouble writing documentation.
Fun stuff.

@gfontenot
Copy link
Collaborator Author

Note that this is a non-breaking change 🎉

@tonyd256
Copy link
Contributor

tonyd256 commented Apr 4, 2016

👍 love it

There wasn't actually any real reason to limit this to working on
`[String: Decoded<T>]` values. Instead, we should be able to use this
function with any key type.
@@ -42,8 +42,8 @@ public func sequence<T>(xs: [Decoded<T>]) -> Decoded<[T]> {
- returns: A `Decoded` `Dictionary` of unwrapped `T` values assigned to their
original keys
*/
public func sequence<T>(xs: [String: Decoded<T>]) -> Decoded<[String: T]> {
var accum = Dictionary<String, T>(minimumCapacity: xs.count)
public func sequence<Key, Value>(xs: [Key: Decoded<Value>]) -> Decoded<[Key: Value]> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable Name Violation: Variable name should be between 3 and 40 characters long: 'xs' (variable_name)

@gfontenot gfontenot merged commit 6b5c06e into master Apr 5, 2016
@gfontenot gfontenot deleted the gf-generalize-sequence branch April 5, 2016 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants