在下面的示例中,我希望能够直接调用“ls”函数(请参阅示例的最后注释掉的行),但我无法找出正确的语法。提前致谢。
module Main (main) where
import System.Directory
ls :: FilePath -> IO [FilePath]
ls dir = do
fileList <- getDirectoryContents dir
return fileList
main = do
fileList <- ls "."
mapM putStrLn fileList
-- How can I just use the ls call directly like in the following (which doesn't compile)?
-- mapM putStrLn (ls".")