-
Notifications
You must be signed in to change notification settings - Fork 19
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
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
There was a problem hiding this 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(_))) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure!
Thanks! |
Oh, it looks like git can’t tell this is independent of your previous PR and there is a merge conflict. :( |
close #39