-
Notifications
You must be signed in to change notification settings - Fork 259
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
Tidy up HashMap and MultiMap #864
Conversation
@fumieval Just a confirmation. Do you notice that |
No, but that shouldn't matter for this change |
!h = hash path | ||
!mm' = I.insertWith (<>) h [(path,v)] mm | ||
insert path v (MultiMap mm) = MultiMap | ||
$ I.insertWith (flip (<>)) (hash path) [(path,v)] mm |
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.
I don't understand why flip
is introduced here.
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.
insertWith (++) is quadratic because it appends an element to a list. Does anything depend on the order of inner lists?
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.
Isn't insertWith (++)
prepending?
https://hackage.haskell.org/package/containers-0.6.5.1/docs/Data-IntMap-Strict.html#v:insertWith
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.
Ah ok, I misunderstood then
[] -> go kss acc | ||
_ -> go kss ((h,rs) : acc) | ||
pruneWith (MultiMap mm) action = I.foldrWithKey | ||
(\h s cont acc -> do |
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.
I would like to change this function to a local function after where
.
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.
Can you explain why? Is it a style preference or does it produce a better core?
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.
Just a style preference.
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.
OK
Removed a lot of unnecessary strict bindings
I run CI again. |
We should understand whether or not the following failure on Windows is due to this PR:
|
I run CI once more and it succeeded. Let's merge. |
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.
Now LGTM.
Rebased and merged. Thank you for your contribution! |
Removed a lot of unnecessary strict bindings
Before submitting your PR, check that you've:
@since
declarations to the HaddockAfter submitting your PR: