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

add HMap.mapValues #41

Merged
merged 3 commits into from
Mar 9, 2019
Merged

Conversation

alexeygorobets
Copy link
Contributor

close #39

@codecov-io
Copy link

codecov-io commented Mar 9, 2019

Codecov Report

Merging #41 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #41      +/-   ##
==========================================
+ Coverage   82.66%   82.71%   +0.04%     
==========================================
  Files          13       13              
  Lines         375      376       +1     
  Branches       20       20              
==========================================
+ Hits          310      311       +1     
  Misses         65       65
Impacted Files Coverage Δ
core/src/main/scala/com/stripe/dagon/HMap.scala 96% <100%> (+0.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6c18eab...7e3d4ed. Read the comment docs.

Copy link
Collaborator

@johnynek johnynek left a comment

Choose a reason for hiding this comment

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

Thank you so much! I really appreciate this.

@@ -81,6 +81,9 @@ final class HMap[K[_], V[_]](protected val map: Map[K[_], V[_]]) extends Seriali
val fnAny = f.toFunction[Any].andThen(_.iterator)
map.iterator.asInstanceOf[Iterator[(K[Any], V[Any])]].flatMap(fnAny).toStream
}

def mapValues[V1[_]](f: FunctionK[V, V1]): HMap[K, V1] =
HMap.from[K, V1](map.mapValues(f(_)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually one request, mapValues is lazy on maps and this often burns people. Can we make this strict? map.iterator.map { case (k, v.... or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure!

@johnynek
Copy link
Collaborator

johnynek commented Mar 9, 2019

Thanks!

@johnynek
Copy link
Collaborator

johnynek commented Mar 9, 2019

Oh, it looks like git can’t tell this is independent of your previous PR and there is a merge conflict. :(

@johnynek johnynek merged commit 69d0aa4 into stripe:master Mar 9, 2019
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.

add HMap.mapValues
3 participants