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

Fix the input type of Operators.toRichTraversable #518

Merged
merged 1 commit into from
Apr 14, 2016
Merged

Fix the input type of Operators.toRichTraversable #518

merged 1 commit into from
Apr 14, 2016

Conversation

joshualande
Copy link
Contributor

I could be missing something obvious, but I think Operators.toRichTraversable should take a TraversableOnce instead of a Traversable. This will allow it to be less restrictive in the input types that it allows.

Currently:

scala> import com.twitter.algebird.Operators.toRichTraversable

scala> val x: Traversable[Int] = Traversable(1, 2, 3)
x: Traversable[Int] = List(1, 2, 3)
scala> x.monoidSum
res11: Int = 6

scala> val y: TraversableOnce[Int] = Traversable(1, 2, 3)
y: TraversableOnce[Int] = List(1, 2, 3)
scala> y.monoidSum
<console>:17: error: value monoidSum is not a member of TraversableOnce[Int]
              y.monoidSum
                ^

With my fix:

scala> val y: TraversableOnce[Int] = Traversable(1, 2, 3)
y: TraversableOnce[Int] = List(1, 2, 3)

scala> y.monoidSum
res0: Int = 6

@joshualande
Copy link
Contributor Author

Hmm, it looks my branch didn't build, but I can't figure out what the issue was (https://travis-ci.org/twitter/algebird/jobs/121875937). Does anybody know why it failed?

@isnotinvain
Copy link
Contributor

from the log looks like it got stuck:

No output has been received in the last 10 minutes, this potentially indicates a stalled build or something wrong with the build itself.

If you hit the restart button it may just work.

@isnotinvain
Copy link
Contributor

Is TraversableOnce the right type here? Reading the scala docs, TraversableOnce is the common type between Iterator and Traverseable so that sounds right -- does that imply that Traversables themselves can only be iterated a single time? I can't seem to find that contract.

@joshualande
Copy link
Contributor Author

Hi Alex!

Apparently I would need write access to Algebird to restart the build: http://stackoverflow.com/questions/17606874/trigger-a-travis-ci-rebuild-without-pushing-a-commit. Is there any chance that you or another owner could restart the build?

Concerning your comment about types, the RichTraversable type takes a TraversableOnce so allowing toRichTraversable to take a TraversableOnce will allow a larger range of objects to be passed into the function.

Does that make sense!

Joshua

@isnotinvain
Copy link
Contributor

Yeah that makes sense. I'll restart the build for you.

@joshualande
Copy link
Contributor Author

@isnotinvain thanks so much!!!

@joshualande
Copy link
Contributor Author

@isnotinvain looks like all tests pass now!!! Thanks for your help!

@johnynek johnynek merged commit 01ee2f0 into twitter:develop Apr 14, 2016
@joshualande joshualande deleted the fix_type branch April 14, 2016 01:04
@joshualande
Copy link
Contributor Author

@johnynek thanks so much for the help!!!

@johnynek
Copy link
Collaborator

@joshualande thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants