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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
(** Examples of Path, Fragment and Reference Resolution *)
(** This module contains examples of some of the features of Resolution as
described in the page {!page-features}. See the explanations there for
details on what each of these demonstrates. *)
[@@@warning "-67"]
module Alias : sig
(** Demonstrates a reference to an item in a module that's an alias *)
module A : sig
type t
end
module B = A
type t = B.t
module type A = sig
type t
end
module type B = A
(** {!module-type-B.t} *)
end
module HiddenAlias : sig
(** Demonstrates a reference to an item in a module that's an alias of a
hidden module. *)
(**/**)
module A : sig
type t
end
(**/**)
module B = A
type t = B.t
end
module Canonical : sig
(** Demonstrates the use of canonical tags *)
module A : sig
(** @canonical Odoc_examples.Resolution.Canonical.B *)
type t
end
module B = A
type t = A.t
end
module Fragments : sig
(** Demonstrates the resolution of fragments *)
module type A = sig
module B : sig
type t
val f : t -> t
end
end
module C : A with type B.t = int
module D : module type of C.B with type t := int
end
module Hidden : sig
(** Demonstrates paths to hidden items *)
(**/**)
type t = int
type u
(**/**)
type v = T of t
end
module References : sig
(** Examples of resolution of references *)
module type A = sig
type t
(** type [t] in module type [A] *)
end
module A : sig
type t
(** type [t] in module [A] *)
module B : sig
type t
end
module type B = sig
type t
end
end
(** We can refer unambiguously to {!module-type-A.t} in module type [A] or
{!module-A.t} in module [A], and also where there are name clashes within
the path: {!module-A.module-B.t} or {!module-A.module-type-B.t} *)
end
module Complicated_1 : sig
(** Some more complicated examples of resolution *)
module type A = sig
module M : sig
module type S
end
module N : M.S
end
module B : sig
module type S = sig
type t
end
end
module C : A with module M = B with type N.t = int
type t = C.N.t
end
module Complicated_2 : sig
(** A very complicated example of resolution *)
module type Type = sig
module type T
end
module App : functor
(T : Type)
(F : functor (_ : Type) -> Type)
(M : F(T).T)
-> F(T).T
module Bar : sig
module type T = sig
type bar
end
end
module Foo : functor (T : Type) -> sig
module type T = sig
module Foo : T.T
end
end
module FooBarInt : sig
module Foo : sig
type bar = int
end
end
type t = App(Bar)(Foo)(FooBarInt).Foo.bar
end
|