packages feed

graph-wrapper 0.2.3 → 0.2.4

raw patch · 3 files changed

+13/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Graph.Wrapper: traverseWithKey :: Applicative t => (i -> a -> t b) -> Graph i a -> t (Graph i b)
+ Data.Graph.Wrapper.Internal: traverseWithKey :: Applicative t => (i -> a -> t b) -> Graph i a -> t (Graph i b)

Files

Data/Graph/Wrapper.hs view
@@ -27,7 +27,9 @@          topologicalSort, depthNumbering,     -    SCC(..), stronglyConnectedComponents, sccGraph+    SCC(..), stronglyConnectedComponents, sccGraph,+    +    traverseWithKey   ) where  import Data.Graph.Wrapper.Internal
Data/Graph/Wrapper/Internal.hs view
@@ -5,6 +5,8 @@ {-# OPTIONS_HADDOCK not-home #-} module Data.Graph.Wrapper.Internal where +import Control.Applicative (Applicative)+ import Data.Array import Data.Maybe (fromMaybe) import qualified Data.Graph as G@@ -39,6 +41,13 @@  instance Traversable.Traversable (Graph i) where     traverse f g = fmap (\gvva -> g { gVertexVertexArray = gvva }) (Traversable.traverse f (gVertexVertexArray g))+++traverseWithKey :: Applicative t => (i -> a -> t b) -> Graph i a -> t (Graph i b)+traverseWithKey f g = fmap (\gvva -> g { gVertexVertexArray = gvva }) (traverseWithIndex (\gv -> f (gVertexIndex g gv)) (gVertexVertexArray g))+  where+    traverseWithIndex :: Applicative t => (G.Vertex -> a -> t b) -> Array G.Vertex a -> t (Array G.Vertex b)+    traverseWithIndex f a = fmap (array (bounds a)) $ flip Traversable.traverse (assocs a) $ \(k, v) -> fmap ((,) k) $ f k v   {-# RULES "indexGVertex/gVertexIndex" forall g i. gVertexIndex g (indexGVertex g i) = i #-}
graph-wrapper.cabal view
@@ -1,7 +1,7 @@ Cabal-Version:      >= 1.2 Build-Type:         Simple Name:               graph-wrapper-Version:            0.2.3+Version:            0.2.4 Maintainer:         Max Bolingbroke <batterseapower@hotmail.com> Homepage:           http://www.github.com/batterseapower/graph-wrapper License:            BSD3