[commit: packages/containers] ghc-head: Add Functor instance to Data.Graph.SCC (25a1398)

git at git.haskell.org git at git.haskell.org
Thu Jan 16 07:50:46 UTC 2014


Repository : ssh://git@git.haskell.org/containers

On branch  : ghc-head
Link       : http://git.haskell.org/packages/containers.git/commitdiff/25a1398c26384519951214a4434126ef3e0223d5

>---------------------------------------------------------------

commit 25a1398c26384519951214a4434126ef3e0223d5
Author: Nathan Howell <nhowell at alphaheavy.com>
Date:   Tue Sep 10 15:46:51 2013 -0700

    Add Functor instance to Data.Graph.SCC


>---------------------------------------------------------------

25a1398c26384519951214a4434126ef3e0223d5
 Data/Graph.hs |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Data/Graph.hs b/Data/Graph.hs
index 389dea7..d7a4b92 100644
--- a/Data/Graph.hs
+++ b/Data/Graph.hs
@@ -93,6 +93,10 @@ instance NFData a => NFData (SCC a) where
     rnf (AcyclicSCC v) = rnf v
     rnf (CyclicSCC vs) = rnf vs
 
+instance Functor SCC where
+    fmap f (AcyclicSCC v) = AcyclicSCC (f v)
+    fmap f (CyclicSCC vs) = CyclicSCC (fmap f vs)
+
 -- | The vertices of a list of strongly connected components.
 flattenSCCs :: [SCC a] -> [a]
 flattenSCCs = concatMap flattenSCC



More information about the ghc-commits mailing list