Skip to content

Commit 93d79f3

Browse files
committed
Use swap from Data.Tuple
1 parent 1d4bd0e commit 93d79f3

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

Data/Graph/Inductive/PatriciaTree.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import Data.IntMap (IntMap)
3232
import qualified Data.IntMap as IM
3333
import Data.List (foldl', sort)
3434
import Data.Maybe (fromMaybe)
35+
import Data.Tuple (swap)
3536

3637
#if MIN_VERSION_containers (0,4,2)
3738
import Control.DeepSeq (NFData(..))
@@ -259,9 +260,6 @@ toContext v (ps, a, ss) = (toAdj ps, v, a, toAdj ss)
259260
fromContext :: Context a b -> Context' a b
260261
fromContext (ps, _, a, ss) = (fromAdj ps, a, fromAdj ss)
261262

262-
swap :: (a, b) -> (b, a)
263-
swap (a, b) = (b, a)
264-
265263
-- A version of @++@ where order isn't important, so @xs ++ [x]@
266264
-- becomes @x:xs@. Used when we have to have a function of type @[a]
267265
-- -> [a] -> [a]@ but one of the lists is just going to be a single

Data/Graph/Inductive/Query/DFS.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import Data.Graph.Inductive.Graph
5050
import Data.Tree
5151
import qualified Data.Map as Map
5252
import Control.Monad (liftM2)
53-
53+
import Data.Tuple (swap)
5454

5555

5656
-- | Many functions take a list of nodes to visit as an explicit argument.
@@ -244,8 +244,6 @@ condensation gr = mkGraph vs es
244244
vs = zip [1..] sccs
245245
vMap = Map.fromList $ map swap vs
246246

247-
swap = uncurry $ flip (,)
248-
249247
getN = (vMap Map.!)
250248
es = [ (getN c1, getN c2, ()) | c1 <- sccs, c2 <- sccs
251249
, (c1 /= c2) && any (hasEdge gr) (liftM2 (,) c1 c2) ]

0 commit comments

Comments
 (0)