Created
May 24, 2014 12:45
-
-
Save aristidb/bc4eaa627335c1c4e9cc to your computer and use it in GitHub Desktop.
This file contains 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
{-# LANGUAGE ScopedTypeVariables #-} | |
import System.FilePath | |
import System.Directory | |
import Control.Exception | |
dirTree :: FilePath -> IO [FilePath] | |
dirTree f = | |
do names <- getDirectoryContents f `catch` (\(_ :: IOException) -> return []) | |
let paths = (map (f </>) . filter (`notElem` [".", ".."])) names | |
recursed <- mapM dirTree paths | |
return (f : concat recursed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment