Repository navigation
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.
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.
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 <[email protected]>
| -- | /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.
should f preserve the nodeKey of the argument, if it returns Just ?
There was a problem hiding this comment.
Actually I don't need the full generality; I'm going to replace it with deleteLookup.
Signed-off-by: Edward Z. Yang <[email protected]>
| nodeKey (N _ k _) = k | ||
| nodeNeighbors (N _ _ ks) = ks | ||
|
|
||
| -- TODO: Maybe introduce a typeclass for items which just |
|
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 [email protected]
CC @dcoutts @23Skidoo