尝试使用下面的Haskell代码在Mac上读取文件时,我收到一条错误,即权限被拒绝:操作不被允许。
import System.IO
main :: IO ()
main = do
inh <- openFile "/Users/lambda/Downloads/file.doc" ReadMode
inpStr <- hGetContents inh
let [(result,_)] = parse allDigits inpStr
putStr result
hClose inh
result : ** Exception: /Users/lambda/Downloads/file.doc: openFile: permission denied (Operation not permitted)