Troubleshooting F# 解决疑难杂症
https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/troubleshooting-fsharp/
故障排除的一般方法
调用函数时不要使用括号
let add x y = x + y
let result = add (1 2) // 错误
// error FS0003: This value is not a function and cannot be applied
let result = add 1 2 // 正确不要把有多个参数的元组混在一起当成多个参数来使用
addTwoParams (1,2) // trying to pass a single tuple rather than two args
// error FS0001: This expression was expected to have type
// int but here has type 'a * 'b注意参数太少或太多
使用分号作为 list 的分隔符
不要使用 ! 或 != 进行不等于判断
不要使用 = 进行赋值
注意隐藏的制表符
不要将简单值误认为函数值
解决“信息不足”错误的提示
F# compiler errors
Last updated