-- Returns tuple with files and subdirectories inside the given directory
getDirectory :: FilePath -> IO ([FilePath],[FilePath])
getDirectory path =
   do contents <- getDirectoryContents path
      let valid = filter (\x-> x /= "." && x /= "..") contents
      let paths = map (path ++) valid
      files <- filterM doesFileExist paths
      subdirs <- filterM doesDirectoryExist paths
      return (sort files, sort subdirs)
getDirectory :: FilePath -> IO ([FilePath],[FilePath])
getDirectory path =
   do contents <- getDirectoryContents path
      let valid = filter (\x-> x /= "." && x /= "..") contents
      let paths = map (path ++) valid
      files <- filterM doesFileExist paths
      subdirs <- filterM doesDirectoryExist paths
      return (sort files, sort subdirs)
getDirectory path =
   do contents <- getDirectoryContents path
      let valid = filter (\x-> x /= "." && x /= "..") contents
      let paths = map (path ++) valid
      files <- filterM doesFileExist paths
      subdirs <- filterM doesDirectoryExist paths
      return (sort files, sort subdirs)