Skip to content

Instantly share code, notes, and snippets.

(* Good morning everyone, I'm currently learning ocaml for one of my CS class and needed to implement
an avl tree using ocaml. I thought that it would be interesting to go a step further and try
to verify the balance property of the avl tree using the type system. Here's the resulting code
annotated for people new to the ideas of type level programming :)
(* the property we are going to try to verify is that at each node of our tree, the height difference between
the left and the right sub-trees is at most of 1. *)
open Cmdliner
let mycli _ _ = print_endline "Success!"
let interface =
let docv = "INTERFACE" in
let doc = "parse AST as an interface (true or false)" in
Arg.(required & pos 0 (some bool) None & info ~docv ~doc [])