为什么不导入getFileSize

时间:2019-05-19 12:20:48

标签: file haskell

我正在尝试以下代码:

 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中存在它时不导入?

0 个答案:

没有答案