@@ -99,14 +99,6 @@ testExecutable exe cabalFile = do
9999-- * Helper functions
100100-------------------------------------------------------------------------------
101101
102−-- | Find all *files* in the given directory. This function does not recurse,
103−-- nor does it include the special entries @'.'@ or @'..'@ in the result.
104−
105−listDirectoryFiles :: FilePath -> IO [FilePath]
106−listDirectoryFiles dirPath = do
107− entries <- listDirectory dirPath
108− filterM doesFileExist (map (dirPath </>) entries)
109−
110102-- | Find all *files* in the given directory that end with the given suffix.
111103-- This function does not recurse, nor does it include the special entries
112104-- @'.'@ or @'..'@ in the result.
@@ -119,9 +111,9 @@ listDirectoryFiles dirPath = do
119111-- we prefer our own simpler code.
120112
121113listDirectoryFilesBySuffix :: String -> FilePath -> IO [FilePath]
122−listDirectoryFilesBySuffix suff =
123− fmap (filter ((suff ==) . takeExtension)) . listDirectoryFiles
124−
114+listDirectoryFilesBySuffix suff dirPath = do
115+ entries <- listDirectory dirPath
116+ filterM doesFileExist [ dirPath </> e | e <- entries, takeExtension e == suff ]
125117
126118-- | A variant of 'writeFile' that appends a newline to the end of the buffer
127119-- before writing.