File: Type.tex

package info (click to toggle)
ocaml-odoc 2.1.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,744 kB
  • sloc: ml: 37,049; makefile: 124; sh: 79
file content (135 lines) | stat: -rw-r--r-- 15,174 bytes parent folder | download
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
\section{Module \ocamlinlinecode{Type}}\label{module-Type}%
\label{module-Type-type-abstract}\ocamlcodefragment{\ocamltag{keyword}{type} abstract}\begin{ocamlindent}Some \emph{documentation}.\end{ocamlindent}%
\medbreak
\label{module-Type-type-alias}\ocamlcodefragment{\ocamltag{keyword}{type} alias = int}\\
\label{module-Type-type-private+u+}\ocamlcodefragment{\ocamltag{keyword}{type} private\_\allowbreak{} = \ocamltag{keyword}{private} int}\\
\label{module-Type-type-constructor}\ocamlcodefragment{\ocamltag{keyword}{type} 'a constructor = \ocamltag{type-var}{'a}}\\
\label{module-Type-type-arrow}\ocamlcodefragment{\ocamltag{keyword}{type} arrow = int \ocamltag{arrow}{$\rightarrow$} int}\\
\label{module-Type-type-higher+u+order}\ocamlcodefragment{\ocamltag{keyword}{type} higher\_\allowbreak{}order = ( int \ocamltag{arrow}{$\rightarrow$} int ) \ocamltag{arrow}{$\rightarrow$} int}\\
\label{module-Type-type-labeled}\ocamlcodefragment{\ocamltag{keyword}{type} labeled = l:int \ocamltag{arrow}{$\rightarrow$} int}\\
\label{module-Type-type-optional}\ocamlcodefragment{\ocamltag{keyword}{type} optional = ?l:int \ocamltag{arrow}{$\rightarrow$} int}\\
\label{module-Type-type-labeled+u+higher+u+order}\ocamlcodefragment{\ocamltag{keyword}{type} labeled\_\allowbreak{}higher\_\allowbreak{}order = ( l:int \ocamltag{arrow}{$\rightarrow$} int ) \ocamltag{arrow}{$\rightarrow$} ( ?l:int \ocamltag{arrow}{$\rightarrow$} int ) \ocamltag{arrow}{$\rightarrow$} int}\\
\label{module-Type-type-pair}\ocamlcodefragment{\ocamltag{keyword}{type} pair = int * int}\\
\label{module-Type-type-parens+u+dropped}\ocamlcodefragment{\ocamltag{keyword}{type} parens\_\allowbreak{}dropped = int * int}\\
\label{module-Type-type-triple}\ocamlcodefragment{\ocamltag{keyword}{type} triple = int * int * int}\\
\label{module-Type-type-nested+u+pair}\ocamlcodefragment{\ocamltag{keyword}{type} nested\_\allowbreak{}pair = (int * int) * int}\\
\label{module-Type-type-instance}\ocamlcodefragment{\ocamltag{keyword}{type} instance = int \hyperref[module-Type-type-constructor]{\ocamlinlinecode{constructor}}}\\
\label{module-Type-type-long}\ocamlcodefragment{\ocamltag{keyword}{type} long =
  \hyperref[module-Type-type-labeled+u+higher+u+order]{\ocamlinlinecode{labeled\_\allowbreak{}higher\_\allowbreak{}order}} \ocamltag{arrow}{$\rightarrow$}
  [ `Bar | `Baz of \hyperref[module-Type-type-triple]{\ocamlinlinecode{triple}} ] \ocamltag{arrow}{$\rightarrow$}
  \hyperref[module-Type-type-pair]{\ocamlinlinecode{pair}} \ocamltag{arrow}{$\rightarrow$}
  \hyperref[module-Type-type-labeled]{\ocamlinlinecode{labeled}} \ocamltag{arrow}{$\rightarrow$}
  \hyperref[module-Type-type-higher+u+order]{\ocamlinlinecode{higher\_\allowbreak{}order}} \ocamltag{arrow}{$\rightarrow$}
  ( string \ocamltag{arrow}{$\rightarrow$} int ) \ocamltag{arrow}{$\rightarrow$}
  (int * float * char * string * char * unit) option \ocamltag{arrow}{$\rightarrow$}
  \hyperref[module-Type-type-nested+u+pair]{\ocamlinlinecode{nested\_\allowbreak{}pair}} \ocamltag{arrow}{$\rightarrow$}
  \hyperref[module-Type-type-arrow]{\ocamlinlinecode{arrow}} \ocamltag{arrow}{$\rightarrow$}
  string \ocamltag{arrow}{$\rightarrow$}
  \hyperref[module-Type-type-nested+u+pair]{\ocamlinlinecode{nested\_\allowbreak{}pair}} array}\\
\label{module-Type-type-variant+u+e}\ocamlcodefragment{\ocamltag{keyword}{type} variant\_\allowbreak{}e = \{}\\
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlinlinecode{a : int;\allowbreak{}}\label{module-Type-type-variant+u+e.a}\\
\end{ocamltabular}%
\\
\ocamlcodefragment{\}}\\
\label{module-Type-type-variant}\ocamlcodefragment{\ocamltag{keyword}{type} variant = }\\
\begin{ocamltabular}{p{0.500\textwidth}p{0.500\textwidth}}\ocamlcodefragment{| \ocamltag{constructor}{A}}\label{module-Type-type-variant.A}& \\
\ocamlcodefragment{| \ocamltag{constructor}{B} \ocamltag{keyword}{of} int}\label{module-Type-type-variant.B}& \\
\ocamlcodefragment{| \ocamltag{constructor}{C}}\label{module-Type-type-variant.C}& foo\\
\ocamlcodefragment{| \ocamltag{constructor}{D}}\label{module-Type-type-variant.D}& \emph{bar}\\
\ocamlcodefragment{| \ocamltag{constructor}{E} \ocamltag{keyword}{of} \hyperref[module-Type-type-variant+u+e]{\ocamlinlinecode{variant\_\allowbreak{}e}}}\label{module-Type-type-variant.E}& \\
\end{ocamltabular}%
\\
\label{module-Type-type-variant+u+c}\ocamlcodefragment{\ocamltag{keyword}{type} variant\_\allowbreak{}c = \{}\\
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlinlinecode{a : int;\allowbreak{}}\label{module-Type-type-variant+u+c.a}\\
\end{ocamltabular}%
\\
\ocamlcodefragment{\}}\\
\label{module-Type-type-gadt}\ocamlcodefragment{\ocamltag{keyword}{type} \_\allowbreak{} gadt = }\\
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlcodefragment{| \ocamltag{constructor}{A} : int \hyperref[module-Type-type-gadt]{\ocamlinlinecode{gadt}}}\label{module-Type-type-gadt.A}\\
\ocamlcodefragment{| \ocamltag{constructor}{B} : int \ocamltag{arrow}{$\rightarrow$} string \hyperref[module-Type-type-gadt]{\ocamlinlinecode{gadt}}}\label{module-Type-type-gadt.B}\\
\ocamlcodefragment{| \ocamltag{constructor}{C} : \hyperref[module-Type-type-variant+u+c]{\ocamlinlinecode{variant\_\allowbreak{}c}} \ocamltag{arrow}{$\rightarrow$} unit \hyperref[module-Type-type-gadt]{\ocamlinlinecode{gadt}}}\label{module-Type-type-gadt.C}\\
\end{ocamltabular}%
\\
\label{module-Type-type-degenerate+u+gadt}\ocamlcodefragment{\ocamltag{keyword}{type} degenerate\_\allowbreak{}gadt = }\\
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlcodefragment{| \ocamltag{constructor}{A} : \hyperref[module-Type-type-degenerate+u+gadt]{\ocamlinlinecode{degenerate\_\allowbreak{}gadt}}}\label{module-Type-type-degenerate+u+gadt.A}\\
\end{ocamltabular}%
\\
\label{module-Type-type-private+u+variant}\ocamlcodefragment{\ocamltag{keyword}{type} private\_\allowbreak{}variant = \ocamltag{keyword}{private} }\\
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlcodefragment{| \ocamltag{constructor}{A}}\label{module-Type-type-private+u+variant.A}\\
\end{ocamltabular}%
\\
\label{module-Type-type-record}\ocamlcodefragment{\ocamltag{keyword}{type} record = \{}\\
\begin{ocamltabular}{p{0.500\textwidth}p{0.500\textwidth}}\ocamlinlinecode{a : int;\allowbreak{}}\label{module-Type-type-record.a}& \\
\ocamlinlinecode{\ocamltag{keyword}{mutable} b : int;\allowbreak{}}\label{module-Type-type-record.b}& \\
\ocamlinlinecode{c : int;\allowbreak{}}\label{module-Type-type-record.c}& foo\\
\ocamlinlinecode{d : int;\allowbreak{}}\label{module-Type-type-record.d}& \emph{bar}\\
\ocamlinlinecode{e : 'a.\allowbreak{} \ocamltag{type-var}{'a};\allowbreak{}}\label{module-Type-type-record.e}& \\
\end{ocamltabular}%
\\
\ocamlcodefragment{\}}\\
\label{module-Type-type-polymorphic+u+variant}\ocamlcodefragment{\ocamltag{keyword}{type} polymorphic\_\allowbreak{}variant = [ }\\
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlinlinecode{| }\ocamlinlinecode{`A}\label{module-Type-type-polymorphic+u+variant.A}\\
\ocamlinlinecode{| }\ocamlinlinecode{`B \ocamltag{keyword}{of} int}\label{module-Type-type-polymorphic+u+variant.B}\\
\ocamlinlinecode{| }\ocamlinlinecode{`C \ocamltag{keyword}{of} int * unit}\label{module-Type-type-polymorphic+u+variant.C}\\
\ocamlinlinecode{| }\ocamlinlinecode{`D}\label{module-Type-type-polymorphic+u+variant.D}\\
\end{ocamltabular}%
\\
\ocamlcodefragment{ ]}\\
\label{module-Type-type-polymorphic+u+variant+u+extension}\ocamlcodefragment{\ocamltag{keyword}{type} polymorphic\_\allowbreak{}variant\_\allowbreak{}extension = [ }\\
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlinlinecode{| }\ocamlinlinecode{\hyperref[module-Type-type-polymorphic+u+variant]{\ocamlinlinecode{polymorphic\_\allowbreak{}variant}}}\label{module-Type-type-polymorphic+u+variant+u+extension.polymorphic+u+variant}\\
\ocamlinlinecode{| }\ocamlinlinecode{`E}\label{module-Type-type-polymorphic+u+variant+u+extension.E}\\
\end{ocamltabular}%
\\
\ocamlcodefragment{ ]}\\
\label{module-Type-type-nested+u+polymorphic+u+variant}\ocamlcodefragment{\ocamltag{keyword}{type} nested\_\allowbreak{}polymorphic\_\allowbreak{}variant = [ }\\
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlinlinecode{| }\ocamlinlinecode{`A \ocamltag{keyword}{of} [ `B | `C ]}\label{module-Type-type-nested+u+polymorphic+u+variant.A}\\
\end{ocamltabular}%
\\
\ocamlcodefragment{ ]}\\
\label{module-Type-type-private+u+extenion#row}\ocamlcodefragment{\ocamltag{keyword}{type} private\_\allowbreak{}extenion\#row}\\
\label{module-Type-type-private+u+extenion}\ocamlcodefragment{\ocamltag{keyword}{and} private\_\allowbreak{}extenion = \ocamltag{keyword}{private} [> }\\
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlinlinecode{| }\ocamlinlinecode{\hyperref[module-Type-type-polymorphic+u+variant]{\ocamlinlinecode{polymorphic\_\allowbreak{}variant}}}\label{module-Type-type-private+u+extenion.polymorphic+u+variant}\\
\end{ocamltabular}%
\\
\ocamlcodefragment{ ]}\\
\label{module-Type-type-object+u+}\ocamlcodefragment{\ocamltag{keyword}{type} object\_\allowbreak{} = < a : int ;\allowbreak{} b : int ;\allowbreak{} c : int >}\\
\label{module-Type-module-type-X}\ocamlcodefragment{\ocamltag{keyword}{module} \ocamltag{keyword}{type} \hyperref[module-Type-module-type-X]{\ocamlinlinecode{X}}}\ocamlcodefragment{ = \ocamltag{keyword}{sig}}\begin{ocamlindent}\label{module-Type-module-type-X-type-t}\ocamlcodefragment{\ocamltag{keyword}{type} t}\\
\label{module-Type-module-type-X-type-u}\ocamlcodefragment{\ocamltag{keyword}{type} u}\\
\end{ocamlindent}%
\ocamlcodefragment{\ocamltag{keyword}{end}}\\
\label{module-Type-type-module+u+}\ocamlcodefragment{\ocamltag{keyword}{type} module\_\allowbreak{} = (\ocamltag{keyword}{module} \hyperref[module-Type-module-type-X]{\ocamlinlinecode{X}})}\\
\label{module-Type-type-module+u+substitution}\ocamlcodefragment{\ocamltag{keyword}{type} module\_\allowbreak{}substitution = (\ocamltag{keyword}{module} \hyperref[module-Type-module-type-X]{\ocamlinlinecode{X}} \ocamltag{keyword}{with} \ocamltag{keyword}{type} \hyperref[module-Type-module-type-X-type-t]{\ocamlinlinecode{t}} = int \ocamltag{keyword}{and} \ocamltag{keyword}{type} \hyperref[module-Type-module-type-X-type-u]{\ocamlinlinecode{u}} = unit)}\\
\label{module-Type-type-covariant}\ocamlcodefragment{\ocamltag{keyword}{type} +'a covariant}\\
\label{module-Type-type-contravariant}\ocamlcodefragment{\ocamltag{keyword}{type} -'a contravariant}\\
\label{module-Type-type-bivariant}\ocamlcodefragment{\ocamltag{keyword}{type} \_\allowbreak{} bivariant = int}\\
\label{module-Type-type-binary}\ocamlcodefragment{\ocamltag{keyword}{type} ('a,\allowbreak{} 'b) binary}\\
\label{module-Type-type-using+u+binary}\ocamlcodefragment{\ocamltag{keyword}{type} using\_\allowbreak{}binary = ( int,\allowbreak{} int ) \hyperref[module-Type-type-binary]{\ocamlinlinecode{binary}}}\\
\label{module-Type-type-name}\ocamlcodefragment{\ocamltag{keyword}{type} 'custom name}\\
\label{module-Type-type-constrained}\ocamlcodefragment{\ocamltag{keyword}{type} 'a constrained = \ocamltag{type-var}{'a} \ocamltag{keyword}{constraint} \ocamltag{type-var}{'a} = int}\\
\label{module-Type-type-exact+u+variant}\ocamlcodefragment{\ocamltag{keyword}{type} 'a exact\_\allowbreak{}variant = \ocamltag{type-var}{'a} \ocamltag{keyword}{constraint} \ocamltag{type-var}{'a} = [ `A | `B of int ]}\\
\label{module-Type-type-lower+u+variant}\ocamlcodefragment{\ocamltag{keyword}{type} 'a lower\_\allowbreak{}variant = \ocamltag{type-var}{'a} \ocamltag{keyword}{constraint} \ocamltag{type-var}{'a} = [> `A | `B of int ]}\\
\label{module-Type-type-any+u+variant}\ocamlcodefragment{\ocamltag{keyword}{type} 'a any\_\allowbreak{}variant = \ocamltag{type-var}{'a} \ocamltag{keyword}{constraint} \ocamltag{type-var}{'a} = [>  ]}\\
\label{module-Type-type-upper+u+variant}\ocamlcodefragment{\ocamltag{keyword}{type} 'a upper\_\allowbreak{}variant = \ocamltag{type-var}{'a} \ocamltag{keyword}{constraint} \ocamltag{type-var}{'a} = [< `A | `B of int ]}\\
\label{module-Type-type-named+u+variant}\ocamlcodefragment{\ocamltag{keyword}{type} 'a named\_\allowbreak{}variant = \ocamltag{type-var}{'a} \ocamltag{keyword}{constraint} \ocamltag{type-var}{'a} = [< \hyperref[module-Type-type-polymorphic+u+variant]{\ocamlinlinecode{polymorphic\_\allowbreak{}variant}} ]}\\
\label{module-Type-type-exact+u+object}\ocamlcodefragment{\ocamltag{keyword}{type} 'a exact\_\allowbreak{}object = \ocamltag{type-var}{'a} \ocamltag{keyword}{constraint} \ocamltag{type-var}{'a} = < a : int ;\allowbreak{} b : int >}\\
\label{module-Type-type-lower+u+object}\ocamlcodefragment{\ocamltag{keyword}{type} 'a lower\_\allowbreak{}object = \ocamltag{type-var}{'a} \ocamltag{keyword}{constraint} \ocamltag{type-var}{'a} = < a : int ;\allowbreak{} b : int.\allowbreak{}.\allowbreak{} >}\\
\label{module-Type-type-poly+u+object}\ocamlcodefragment{\ocamltag{keyword}{type} 'a poly\_\allowbreak{}object = \ocamltag{type-var}{'a} \ocamltag{keyword}{constraint} \ocamltag{type-var}{'a} = < a : 'a.\allowbreak{} \ocamltag{type-var}{'a} >}\\
\label{module-Type-type-double+u+constrained}\ocamlcodefragment{\ocamltag{keyword}{type} ('a,\allowbreak{} 'b) double\_\allowbreak{}constrained = \ocamltag{type-var}{'a} * \ocamltag{type-var}{'b} \ocamltag{keyword}{constraint} \ocamltag{type-var}{'a} = int \ocamltag{keyword}{constraint} \ocamltag{type-var}{'b} = unit}\\
\label{module-Type-type-as+u+}\ocamlcodefragment{\ocamltag{keyword}{type} as\_\allowbreak{} = int \ocamltag{keyword}{as} 'a * \ocamltag{type-var}{'a}}\\
\label{module-Type-type-extensible}\ocamlcodefragment{\ocamltag{keyword}{type} extensible = .\allowbreak{}.\allowbreak{}}\\
\label{module-Type-extension-decl-Extension}\ocamlcodefragment{\ocamltag{keyword}{type} \hyperref[module-Type-type-extensible]{\ocamlinlinecode{extensible}} += }\\
\begin{ocamltabular}{p{0.500\textwidth}p{0.500\textwidth}}\ocamlcodefragment{| \ocamltag{extension}{Extension}}\label{module-Type-extension-Extension}& Documentation for \hyperref[module-Type-extension-Extension]{\ocamlinlinecode{\ocamlinlinecode{Extension}}[p\pageref*{module-Type-extension-Extension}]}.\\
\ocamlcodefragment{| \ocamltag{extension}{Another\_\allowbreak{}extension}}\label{module-Type-extension-Another+u+extension}& Documentation for \hyperref[module-Type-extension-Another+u+extension]{\ocamlinlinecode{\ocamlinlinecode{Another\_\allowbreak{}extension}}[p\pageref*{module-Type-extension-Another+u+extension}]}.\\
\end{ocamltabular}%
\\
\label{module-Type-type-mutually}\ocamlcodefragment{\ocamltag{keyword}{type} mutually = }\\
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlcodefragment{| \ocamltag{constructor}{A} \ocamltag{keyword}{of} \hyperref[module-Type-type-recursive]{\ocamlinlinecode{recursive}}}\label{module-Type-type-mutually.A}\\
\end{ocamltabular}%
\\
\label{module-Type-type-recursive}\ocamlcodefragment{\ocamltag{keyword}{and} recursive = }\\
\begin{ocamltabular}{p{1.000\textwidth}}\ocamlcodefragment{| \ocamltag{constructor}{B} \ocamltag{keyword}{of} \hyperref[module-Type-type-mutually]{\ocamlinlinecode{mutually}}}\label{module-Type-type-recursive.B}\\
\end{ocamltabular}%
\\
\label{module-Type-exception-Foo}\ocamlcodefragment{\ocamltag{keyword}{exception} \ocamltag{exception}{Foo} \ocamltag{keyword}{of} int * int}\\