diff --git a/src/Main.hs b/src/Main.hs index 46a2bfe..1c32ae9 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -57,7 +57,7 @@ main :: IO () main = do Cmd{..} <- getRecord "Image duplicate finder" -- XXX: This is a really long line, split it up - fingerprints <- runSafeT (P.fold (\acc -> either (const acc) (\x -> x `seq` x : acc)) [] id (find source (glob "*.jpg" <> regular) >-> P.mapM (\path -> fmap (path,) <$> liftIO (readImage path)) >-> P.map (fmap (\(path, img) -> Fingerprint path (fingerprint img))))) + fingerprints <- runSafeT (P.fold (\acc -> either (const acc) (\x -> x `seq` x : acc)) [] id (find source (glob "*.jpg" <> regular) >-> P.mapM (\path -> liftIO (putStrLn path) >> fmap (path,) <$> liftIO (readImage path)) >-> P.map (fmap (\(path, img) -> Fingerprint path (fingerprint img))))) let index = foldl' (flip BK.insert) BK.empty fingerprints forM_ fingerprints $ \fp -> do let similar = BK.search 1 fp index