Broken commit (removed loadKeyConfig)
This commit is contained in:
+7
-3
@@ -1,12 +1,16 @@
|
||||
module Dodge.Graph
|
||||
where
|
||||
( pairsToSCC
|
||||
, incidenceToFunction
|
||||
, pairsToIncidence
|
||||
) where
|
||||
-- this deserves tests
|
||||
import Data.List.Extra
|
||||
|
||||
import Data.Bifunctor (first)
|
||||
import Data.Graph
|
||||
import Data.Maybe
|
||||
|
||||
pairsToIncidence :: (Eq a,Ord a) => [(a,a)] -> [(a,[a])]
|
||||
pairsToIncidence :: Ord a => [(a,a)] -> [(a,[a])]
|
||||
pairsToIncidence
|
||||
= map (first head . unzip)
|
||||
. groupOn fst
|
||||
@@ -18,5 +22,5 @@ incidenceToFunction xs a = fromMaybe [] $ lookup a xs
|
||||
mkNode :: (a,[a]) -> (a,a,[a])
|
||||
mkNode (x,xs) = (x,x,xs)
|
||||
|
||||
pairsToSCC :: (Eq a, Ord a) => [(a,a)] -> [SCC a]
|
||||
pairsToSCC :: Ord a => [(a,a)] -> [SCC a]
|
||||
pairsToSCC = stronglyConnComp . map mkNode . pairsToIncidence
|
||||
|
||||
Reference in New Issue
Block a user