ocaml类型构造函数参数

Mik*_*ike 3 constructor ocaml types type-constructor

我这样定义了一个AVL树,其中'a - >'a - > int是比较函数

type 'a t = Empty of ('a -> 'a -> int)
  | Node of 'a * 'a t * 'a t * ('a -> 'a -> int)
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用此AVL模块在单独的模块中实现优先级队列.

type 'a t = Queue of (Avl.t * int)
Run Code Online (Sandbox Code Playgroud)

但是当我尝试编译时,我得到了这个错误:

 Error: The type constructor Avl.t expects 1 argument(s),
   but is here applied to 0 argument(s)
Run Code Online (Sandbox Code Playgroud)

它在谈论什么参数以及队列类型中的语法应该是什么?

Jef*_*eld 5

您的AVL树由nodes('a)中的类型参数化.所以你应该可以说

type 'a t = Queue of ('a Avl.t * int)
Run Code Online (Sandbox Code Playgroud)