package refl

  1. Overview
  2. Docs

Source file common.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module OrderedLongident = struct
  type t = Longident.t

  let compare = compare
end

module LongidentSet = Set.Make (OrderedLongident)

module StringSet = Set.Make (String)

module StringMap = Map.Make (String)

module StringHashtbl = Hashtbl.Make (struct
  type t = string

  let equal = String.equal

  let hash = Hashtbl.hash
end)

module IntSet = Set.Make (Int)

module IntMap = Map.Make (Int)

let subst_ident f (type_ident : Longident.t) : Longident.t =
  match type_ident with
  | Lident type_name -> Lident (f type_name)
  | Ldot (path, type_name) -> Ldot (path, f type_name)
  | Lapply _ -> invalid_arg "subst_ident"
OCaml

Innovation. Community. Security.