-
Notifications
You must be signed in to change notification settings - Fork 712
Add Distribution.Compat.Graph, fixes #3521. #3523
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
Conversation
Fails on AppVeyor due to |
Huh, I wonder why that didn't light up Travis. |
return (N a k (ordNub neighbors)) | ||
return (fromList ns) | ||
|
||
ordNub :: Ord a => [a] -> [a] |
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.
You can use the one in D.S.Utils
.
Addressed comments and force-pushed. Also a few more functions for interface. |
nodeKey (N _ k _) = k | ||
nodeNeighbors (N _ _ ks) = ks | ||
|
||
-- TODO: Maybe split this type class into two |
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.
which type, into what?
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.
The thought is that IsNode can be decomposed into two typeclasses: one with Key and nodeKey (representing data types that have "keys") and the one that adds nodeNeighbors. The former typeclass is independently useful; e.g., you can provide an alternate Map with insert :: HasKey a => a -> Map a -> Map a (no need to specify key; it's embedded in the item.) But it's not useful for what I needed this for...
b247549
to
3832e45
Compare
The intent is for this to be used to replace most of the current PackageIndex and InstallPlan implementations. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
-- | /O(log V)/. Lookup and update. This function returns the changed | ||
-- value if updated, and the original value if it was deleted. | ||
updateLookup :: IsNode a => (a -> Maybe a) -> Key a -> Graph a -> (Maybe a, Graph a) | ||
updateLookup f k g = |
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.
should f
preserve the nodeKey
of the argument, if it returns Just
?
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 I don't need the full generality; I'm going to replace it with deleteLookup.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
nodeKey (N _ k _) = k | ||
nodeNeighbors (N _ _ ks) = ks | ||
|
||
-- TODO: Maybe introduce a typeclass for items which just |
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.
s/which/with/
Typofixed, and merged. |
The intent is for this to be used to replace most of
the current PackageIndex and InstallPlan implementations.
Signed-off-by: Edward Z. Yang ezyang@cs.stanford.edu
CC @dcoutts @23Skidoo