comfort-graph 0.0.0.1 → 0.0.0.2
raw patch · 2 files changed
+23/−11 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- comfort-graph.cabal +2/−2
- src/Data/Graph/Comfort.hs +21/−9
comfort-graph.cabal view
@@ -1,5 +1,5 @@ Name: comfort-graph-Version: 0.0.0.1+Version: 0.0.0.2 Synopsis: Graph structure with type parameters for nodes and edges Description: This graph structure is based on "Data.Map"@@ -51,7 +51,7 @@ Cabal-Version: >=1.10 Source-Repository this- Tag: 0.0.0.1+ Tag: 0.0.0.2 Type: darcs Location: http://hub.darcs.net/thielema/comfort-graph
src/Data/Graph/Comfort.hs view
@@ -69,7 +69,7 @@ import qualified Test.QuickCheck as QC import Data.Functor (Functor, fmap)-import Data.List (map, any, (++))+import Data.List (map, any, all, (++)) import Data.Maybe (Maybe) import Data.Bool (Bool, not, (&&), (||)) import Data.Eq (Eq, (==))@@ -111,8 +111,8 @@ && (Fold.and $ flip Map.mapWithKey ns $ \n (ins,_nl,outs) ->- Fold.all ((n==) . toWrap) (Map.keysSet ins) &&- Fold.all ((n==) . fromWrap) (Map.keysSet outs))+ all ((n==) . toWrap) (Map.keys ins) &&+ all ((n==) . fromWrap) (Map.keys outs)) type LabeledNode n label = (n, label)@@ -379,10 +379,10 @@ (Edge e, Ord n) => Graph e n el nl -> n -> [n] _pre g n =- Set.toList . Set.map fromWrap . Map.keysSet . fst3 .+ map fromWrap . Map.keys . fst3 . Map.findWithDefault (error "pre: unknown node") n . graphMapWrap $ g suc g n =- Set.toList . Set.map toWrap . Map.keysSet . thd3 .+ map toWrap . Map.keys . thd3 . Map.findWithDefault (error "suc: unknown node") n . graphMapWrap $ g adjacentEdges ::@@ -411,8 +411,12 @@ withWrappedGraph $ \ns -> case Map.findWithDefault (error "deleteNode: unknown node") n ns of (ins, _nl, outs) ->- applyMap (Map.mapKeys fromWrap $ Map.mapWithKey (\e _ -> mapThd3 $ Map.delete e) ins) $- applyMap (Map.mapKeys toWrap $ Map.mapWithKey (\e _ -> mapFst3 $ Map.delete e) outs) $+ applyMap+ (Map.mapKeys fromWrap $+ Map.mapWithKey (\e _ -> mapThd3 $ Map.delete e) ins) $+ applyMap+ (Map.mapKeys toWrap $+ Map.mapWithKey (\e _ -> mapFst3 $ Map.delete e) outs) $ Map.delete n ns {- |@@ -460,6 +464,9 @@ nl, MapU.mapMaybeKeys (fmap TC.Wrap . f . TC.unwrap) outs)) +{- |+Same restrictions as in 'mapMaybeEdgeKeys'.+-} mapEdgeKeys :: (Edge e1, Ord n) => (e0 n -> e1 n) ->@@ -498,6 +505,7 @@ existing edges are replaced with new labels. However, I think we should better have an extra function for this purpose and you should not rely on this behavior.+It is an unchecked error if edges between non-existing nodes are inserted. -} insertEdgeSet :: (Edge e, Ord n) =>@@ -505,8 +513,12 @@ insertEdgeSet es = let ess = Map.mapWithKey Map.singleton $ wrapMap es in withWrappedGraph $- applyMap (fmap (\new -> mapFst3 (Map.union new)) $ Map.mapKeysWith Map.union toWrap ess) .- applyMap (fmap (\new -> mapThd3 (Map.union new)) $ Map.mapKeysWith Map.union fromWrap ess)+ applyMap+ (fmap (\new -> mapFst3 (Map.union new)) $+ Map.mapKeysWith Map.union toWrap ess) .+ applyMap+ (fmap (\new -> mapThd3 (Map.union new)) $+ Map.mapKeysWith Map.union fromWrap ess) fromList :: (Edge e, Ord n) =>