4

I defined an AVL tree as such, with 'a -> 'a -> int being the comparison function

type 'a t = Empty of ('a -> 'a -> int)
  | Node of 'a * 'a t * 'a t * ('a -> 'a -> int)

I'm trying to use this AVL module to implement a priority queue in a separate module.

type 'a t = Queue of (Avl.t * int)

But when I try to compile I get this error:

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

What argument is it talking about and what's should the syntax be in the queue type?

Matt Fenwick
  • 48,199
  • 22
  • 128
  • 192
Mike
  • 709
  • 7
  • 19

1 Answers1

6

Your AVL tree is parameterized by the type in the nodes ('a). So you should be able to say

type 'a t = Queue of ('a Avl.t * int)
Jeffrey Scofield
  • 65,646
  • 2
  • 72
  • 108