A generic search framework in OCaml