package file_path

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file common_intf.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
open! Core

(** Common functionality shared by path types. *)
module type S = sig
  module Type : Types.Type

  type t = Type.t
  type comparator_witness = Type.comparator_witness

  include Types.Type with type t := t and type comparator_witness := comparator_witness

  (** Path types have straightforward [to_string] and [sexp_of_t] behavior. [of_string]
      and [t_of_sexp] raise on invalid input (e.g. containing null characters), and
      guarantee canonical output (e.g. no redundant slashes).

      [to_string] is the identity function. [of_string] returns its input when the input
      is a valid string in canonical form. *)
  include
    Identifiable.S with type t := t and type comparator_witness := comparator_witness

  include Invariant.S with type t := t

  (** Command-line argument. Supports tab-completion. *)
  val arg_type : t Command.Arg_type.t
end

(** Stable path type serialization includes bin-io and sexp serialization, along with
    stable set, map, hash table, and hash set serializations. *)
module type Version = sig
  type t [@@deriving equal, hash, sexp_grammar]

  include Stable_comparable.V1 with type t := t
  include Hashable.Stable.V1.S with type key := t
end

module type Stable = sig
  module Type : Types.Type

  module V1 :
    Version with type t = Type.t and type comparator_witness = Type.comparator_witness
end

(** For internal use. Must be implemented to define a path type. *)
module type Basis = sig
  val module_name : string
  val caller_identity : Bin_prot.Shape.Uuid.t
  val is_valid : string -> bool
  val is_canonical : string -> bool
  val canonicalize : string -> string
  val autocomplete : string -> string list
end

module type Common = sig
  module type Basis = Basis
  module type S = S
  module type Stable = Stable

  (** For internal use. Defines new path types. *)
  module Make (T : Types.Type) (Basis : Basis) : sig
    include S with module Type := T
    module Stable : Stable with module Type := T
  end
end
OCaml

Innovation. Community. Security.