Skip to content

Commit 5e007d9

Browse files
authored
Merge pull request #62 from wuerges/master
Use addLists to concatenate lists instead of (++)
2 parents 21457a3 + e3da153 commit 5e007d9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Data/Graph/Inductive/PatriciaTree.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,12 @@ addSucc g0 v numAdd xs
277277
where
278278
go :: GraphRep a b -> Node -> [b] -> GraphRep a b
279279
go g p l = IMS.adjust f p g
280-
where f (ps, l', ss) = let !ss' = IM.insertWith (++) v l ss
280+
where f (ps, l', ss) = let !ss' = IM.insertWith addLists v l ss
281281
in (ps, l', ss')
282282
addSucc g v _ xs = IMS.differenceWith go g xs
283283
where
284284
go :: Context' a b -> [b] -> Maybe (Context' a b)
285-
go (ps, l', ss) l = let !ss' = IM.insertWith (++) v l ss
285+
go (ps, l', ss) l = let !ss' = IM.insertWith addLists v l ss
286286
in Just (ps, l', ss')
287287

288288
addPred :: forall a b . GraphRep a b -> Node -> Int -> IM.IntMap [b] -> GraphRep a b
@@ -291,12 +291,12 @@ addPred g0 v numAdd xs
291291
where
292292
go :: GraphRep a b -> Node -> [b] -> GraphRep a b
293293
go g p l = IMS.adjust f p g
294-
where f (ps, l', ss) = let !ps' = IM.insertWith (++) v l ps
294+
where f (ps, l', ss) = let !ps' = IM.insertWith addLists v l ps
295295
in (ps', l', ss)
296296
addPred g v _ xs = IMS.differenceWith go g xs
297297
where
298298
go :: Context' a b -> [b] -> Maybe (Context' a b)
299-
go (ps, l', ss) l = let !ps' = IM.insertWith (++) v l ps
299+
go (ps, l', ss) l = let !ps' = IM.insertWith addLists v l ps
300300
in Just (ps', l', ss)
301301

302302
clearSucc :: forall a b x . GraphRep a b -> Node -> IM.IntMap x -> GraphRep a b

0 commit comments

Comments
 (0)