我正在尝试以下代码:
import System.Directory (getDirectoryContents, doesFileExist, getFileSize)
-- ...more code
readALine :: FilePath -> IO ()
readALine fname = do
print $ "Filename: " ++ fname
ff <- openFile fname ReadMode
if getFileSize ff > 0 then do
fline <- hGetLine ff
hClose ff
print $ "First line: " <> fline
else return ()
但是出现以下错误:
$ runghc firstline2.hs
firstline2.hs:6:63: error:
Module ‘System.Directory’ does not export ‘getFileSize’
为什么package中存在它时不导入?