The simplest syntax for defining an API looks like:
api Binary_Tree { Binary_Tree = LEAF | NODE { key: Float, left_kid: Binary_Tree, right_kid: Binary_Tree } ; print_tree: Binary_Tree -> Void; };
Here the definition of the Binary_Tree type is exactly as in the previous package declaration, but only the type of the function is declared.
This is exactly the information needed by other packages in order to use the facilities of package binary_tree: They need to know the data structure in order to construct it, and they need to know the type of the print_tree function in order to invoke it correctly, but they need know nothing about the implementation of the print_tree function.