Generic indexed data for OCaml