Created
November 10, 2014 10:35
-
-
Save davidallsopp/c6a27ee9dbcab7fd4f78 to your computer and use it in GitHub Desktop.
Recursively finding files in (cross-platform) Haskell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module FindFiles where | |
| import System.FilePath.Find | |
| -- Can't install FileManip on Windows because it depends on "unix", which (surprise!) can't be installed | |
| -- on Windows without Cygwin etc. Instead, install filemanip not FileManip (obviously ?!) | |
| -- which depends on unix-compat, which is fine on Windows | |
| main :: IO () | |
| main = do | |
| -- paths <- find always always "." | |
| -- paths <- find always (fileType ==? RegularFile) "." | |
| paths <- find always (fileType ==? RegularFile &&? extension ==? ".hs") "." | |
| mapM_ putStrLn paths | |
| -- TODO See also find-conduit (http://hackage.haskell.org/package/find-conduit) | |
| -- which might be handy if planning to use conduit to process the files? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment