struct
  module T = Biocaml_interval_tree

  type 'a t = ('a, unit T.t) Map.Poly.t

  let intersects = LMap.intersects

  let closest loc lset =
    Option.map (LMap.closest loc lset) ~f:(fun (loc', (), d) -> loc', d)

  let intersecting_elems loc lset = 
    LMap.intersecting_elems loc lset /@ fst

  let to_stream lset = LMap.to_stream lset /@ fst
  let of_stream e = e /@ (fun x -> x, ()) |! LMap.of_stream

end