-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathintro.html
More file actions
55 lines (50 loc) · 1.86 KB
/
Copy pathintro.html
File metadata and controls
55 lines (50 loc) · 1.86 KB
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
<h1>Generic Library Reference</h1>
{!indexlist}
{!modules: Generic Generic_util Generic_core Generic_view Generic_fun}
<h2>Main Module</h2>
The module {!Generic} is meant to be used as a single entry
point for using the library. It re-export the content of all
the other namespaces.
<h2>Namespaces</h2>
The library is organised in four namespaces: {!Generic_util}, {!Generic_core},
{!Generic_view} and {!Generic_fun}.
<ul>
<li>
The {!Generic_util} namespace contains some definitions that where
needed by the {!Core} namespace but were too general to belong
there.
</li>
<li>
The modules in namespace {!Generic_core} contain all of the definitions required
for generic programming: type expression are reflected in
the {!Generic_core.Ty.t} type, we call such values type witnesses.
The structure of types is captured by the datatype
{!Generic_core.Desc.t}. The type-indexed function {!Generic_core.Desc_fun.view}
computes the structure associated with each type. It is the
most low-level view of OCaml types. Higher-level views are
derived from this one.
{!Generic_core.Extensible} and {!Generic_core.Consumer} implement a mechanism
for creating and extending type indexed functions. This
enables us to define ad-hoc polymorphic functions.
</li>
<li>
The modules in namespace {!Generic_view} define high-level generic views on
types. A view is a uniform representation of the structure of
types on which generic functions can be defined.
</li>
<li>
The modules in namespace {!Generic_fun} contain generic functions. They are
defined by induction on the structure of types given by a
generic view.
</li>
</ul>
<h2>PPX Syntax Extension</h2>
The library comes with two PPX syntax extensions:
<ul>
<li> [reify] which derives the boilerplate that is
necessary to add generic support for a user type.
</li>
<li> [import] which provides a mechanism for importing a set of
names from a module.
</li>
</ul>