为什么ocaml giving应用于太多的参数错误?

为什么ocaml giving应用于太多的参数错误?,ocaml,Ocaml,我有以下代码: type value = (* an integer or an error message *) | Value of int

我有以下代码:

type value =    (* an integer or an error message *)                                                                                    
  | Value of int                                                                                                                        
  | Error of string;;  

let rec compare_v (lo: value) (ro: value) : value =                                                                                         
  match lo with                                                                                                                         
  | Value(l) ->                                                                                                                         
     match ro with                                                                                                                      
     | Value (r) -> if l == r then Value(1) else Value(-1)  

并运行
比较v值(9)和值(10)提供:

Line 1, characters 0-9:                                                                                                                                                                                                                                                                                                       
1 | compare_v Value(9) Value(10);;                                                                                                                                                                                                                                                                                            
    ^^^^^^^^^                                                                                                                                                                                                                                                                                                                 
Error: This function has type value -> value -> value                                                                                                                                                                                                                                                                         
       It is applied to too many arguments; maybe you forgot a `;'.       

为什么会这样?

此子表达式的解析:

compare_v Value(9) 
是这样的:

(compare_v Value) (9)
在OCaml函数中,应用程序仅通过并置(将两个表达式并排放置)来表示,并且它是左关联的。在此表达式中,有三个表达式并排出现:

compare_v  Value   (9)
左边的关联性给出了您看到的结果

你应该写的是:

compare_v (Value 9)
在OCaml中,您需要使用与主流(Algolic)语言不同的括号。特别是,括号与调用函数没有任何特殊关系