! 在 F# 中的含义不同,它的定义如下。
type 'a ref { Contents : 'a }
let (!) (cell : ref 'a) = cell.Contents
失败是因为你传入了 bool,而 ! 要求的操作数是 bool ref。
改用 not 函数。
if not(File.Exists(inputPath)) then
printfn "inputPath doesn't exist %s" inputPath; failwith "stop"
从英语翻译·查看原文F# gives ! a different meaning, and thats defined as follows:
type 'a ref { Contents : 'a }
let (!) (cell : ref 'a) = cell.Contents
This fails because you supplied a bool, whereas the operand required by ! is a bool ref.
Replace it with the not function:
if not(File.Exists(inputPath)) then
printfn "inputPath doesn't exist %s" inputPath; failwith "stop"