Print current state

This commit is contained in:
Mats Rauhala 2019-01-02 18:12:30 +02:00
parent 61a6efe94e
commit 22c19d0729

View File

@ -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