Permalink
Browse files

Redo the writeDuplicates to use $! instead of bang patterns, should b…

…e more efficient
  • Loading branch information...
ndmitchell committed Sep 17, 2015
1 parent ee0d439 commit 940412cf0b08a375ca521c795355681636fdb86c
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/Output/Types.hs
View
@@ -151,7 +151,8 @@ writeDuplicates :: Ord a => StoreWrite -> [(TargetId, Sig a)] -> IO [Sig a]
writeDuplicates store xs = do
-- s=signature, t=targetid, p=popularity (incoing index), i=index (outgoing index)
xs <- return $ map (second snd) $ sortOn (fst . snd) $ Map.toList $
- Map.fromListWith (\(!x1,x2) (!y1,y2) -> (min x1 y1, x2 ++ y2)) [(s,(p,[t])) | (p,(t,s)) <- zip [0::Int ..] xs]
+ Map.fromListWith (\(x1,x2) (y1,y2) -> (, x2 ++ y2) $! min x1 y1)
+ [(s,(p,[t])) | (p,(t,s)) <- zip [0::Int ..] xs]
-- give a list of TargetId's at each index
storeWrite store TypesDuplicates $ jaggedFromList $ map (reverse . snd) xs
return $ map fst xs

0 comments on commit 940412c

Please sign in to comment.