Skip to content

Commit 673fa92

Browse files
authored
Merge pull request #11 from codex-semantics-library/split-file-with-canonical
Split file with canonical
2 parents 32d86b6 + 8fe8680 commit 673fa92

13 files changed

+239
-206
lines changed

CHANGELOG.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# v0.11.0 - Unreleased
22

3-
- Move all signatures into a new `Sigs` module, also move the `cmp` and `snd` types
4-
into `Sigs`. This is due to breaking up the single file into multiple modules.
5-
Simply using includes would break the documentation
6-
(see: https://github.com/ocaml/odoc/issues/1162)
3+
No public changes yet, but internal refactors.
74

85
# v0.10.0 - 2024-06-01
96

src/PatriciaTree.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
(**************************************************************************)
2121

2222
include Ints
23-
module Sigs = Sigs
23+
include Signatures
2424
include Key_value
2525
include Functors
2626
include Nodes

src/PatriciaTree.mli

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@
9797
notably (key,value) pairs or different types to be in the same map,
9898
or to choose the memory representation of the nodes of the tree.}
9999
100-
{- Some operations like {{!Sigs.BASE_MAP.pop_unsigned_minimum}[pop_unsigned_minimum]} and
101-
{{!Sigs.BASE_MAP.pop_unsigned_maximum}[pop_unsigned_maximum]} make our Set
100+
{- Some operations like {{!BASE_MAP.pop_unsigned_minimum}[pop_unsigned_minimum]} and
101+
{{!BASE_MAP.pop_unsigned_maximum}[pop_unsigned_maximum]} make our Set
102102
suitable as priority queue (but remember that each element in the
103103
queue must map to a distinct integer, and that using the {{!unsigned_lt}unsigned order}
104104
means elements with negative priority are seen as greater than elements with
@@ -115,26 +115,26 @@
115115
informative; log(n) corresponds to the real complexity in usual
116116
distributions. *)
117117

118+
(** {1 Integer manipulations} *)
119+
120+
include module type of Ints
121+
118122
(** {1 Signatures} *)
119123

120-
module Sigs = Sigs
124+
include module type of Signatures
121125

122126
(** {1 Functors} *)
123127

124128
include module type of Functors
125129

126-
(** {1 Miscellaneous utilities} *)
127-
128-
include module type of Ints
129-
130130
(** {1 Default KEY and VALUE implementations} *)
131131
(** These can be used as parameters to {!MakeMap}/{!MakeSet} functors in the
132132
most common use cases. *)
133133

134134
include module type of Key_value
135135

136136
(** {1:node_impl Some implementations of NODE} *)
137-
(** We provide a few different implementations of {!Sigs.NODE}, the internal representation
137+
(** We provide a few different implementations of {!NODE}, the internal representation
138138
of a PatriciaTree's nodes. They can be used with
139139
the {!MakeCustomMap}, {!MakeCustomSet}, {!MakeCustomHeterogeneousMap} and
140140
{!MakeCustomHeterogeneousSet} functors to build maps and sets with custom

src/functors.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
(**************************************************************************)
2121

2222
open Ints
23-
open Sigs
23+
open Signatures
2424
open Key_value
2525
open Nodes
2626

src/functors.mli

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
(* for more details (enclosed in the file LICENSE). *)
2020
(**************************************************************************)
2121

22-
open Sigs
22+
open Signatures
2323

2424
(** This section presents the functors which can be used to build patricia tree
2525
maps and sets. *)
@@ -67,9 +67,9 @@ module MakeHeterogeneousMap(Key: HETEROGENEOUS_KEY)(Value: HETEROGENEOUS_VALUE)
6767
disk, lazy evaluation and/or caching, adding size information for
6868
constant time [cardinal] functions, etc.
6969
70-
See {!node_impl} for the provided implementations of {!Sigs.NODE}, or create your own. *)
70+
See {!node_impl} for the provided implementations of {!NODE}, or create your own. *)
7171

72-
(** Create a homogeneous map with a custom {!Sigs.NODE}. Also allows
72+
(** Create a homogeneous map with a custom {!NODE}. Also allows
7373
customizing the map values *)
7474
module MakeCustomMap
7575
(Key: KEY)
@@ -81,7 +81,7 @@ module MakeCustomMap
8181
and type 'm t = 'm Node.t
8282

8383

84-
(** Create a homogeneous set with a custom {!Sigs.NODE}.
84+
(** Create a homogeneous set with a custom {!NODE}.
8585
@since v0.10.0 *)
8686
module MakeCustomSet
8787
(Key: KEY)
@@ -90,7 +90,7 @@ module MakeCustomSet
9090
with type elt = Key.t
9191
and type 'a BaseMap.t = 'a Node.t
9292

93-
(** Create an heterogeneous map with a custom {!Sigs.NODE}. *)
93+
(** Create an heterogeneous map with a custom {!NODE}. *)
9494
module MakeCustomHeterogeneousMap
9595
(Key: HETEROGENEOUS_KEY)
9696
(Value: HETEROGENEOUS_VALUE)
@@ -100,7 +100,7 @@ module MakeCustomHeterogeneousMap
100100
and type ('k,'m) value = ('k,'m) Value.t
101101
and type 'm t = 'm Node.t
102102

103-
(** Create an heterogeneous set with a custom {!Sigs.NODE}.
103+
(** Create an heterogeneous set with a custom {!NODE}.
104104
@since v0.10.0 *)
105105
module MakeCustomHeterogeneousSet
106106
(Key: HETEROGENEOUS_KEY)
@@ -115,20 +115,20 @@ module MakeCustomHeterogeneousSet
115115
if so they return it, else they return a new node with a new number.
116116
With this unique numbering:
117117
- [equal] and [compare] become constant time operations;
118-
- two maps with the same bindings (where keys are compared by {!Sigs.KEY.to_int} and
119-
values by {!Sigs.HASHED_VALUE.polyeq}) will always be physically equal;
120-
- functions that benefit from sharing, like {!Sigs.BASE_MAP.idempotent_union} and
121-
{!Sigs.BASE_MAP.idempotent_inter} will see improved performance;
118+
- two maps with the same bindings (where keys are compared by {!KEY.to_int} and
119+
values by {!HASHED_VALUE.polyeq}) will always be physically equal;
120+
- functions that benefit from sharing, like {!BASE_MAP.idempotent_union} and
121+
{!BASE_MAP.idempotent_inter} will see improved performance;
122122
- constructors are slightly slower, as they now require a hash-table lookup;
123123
- memory usage is increased: nodes store their tags inside themselves, and
124124
a global hash-table of all built nodes must be maintained.
125125
This is quickly amortized if multiple identical nodes are built,
126126
as only one will be kept in memory.
127127
- hash-consed maps assume their keys and values are immutable, where regular
128128
maps can mutate values freely;
129-
- {b WARNING:} when using physical equality as {!Sigs.HASHED_VALUE.polyeq}, some
129+
- {b WARNING:} when using physical equality as {!HASHED_VALUE.polyeq}, some
130130
{b maps of different types may be given the same identifier}. See the end of
131-
the documentation of {!Sigs.HASHED_VALUE.polyeq} for details.
131+
the documentation of {!HASHED_VALUE.polyeq} for details.
132132
Note that this is the case in the default implementations {!HashedValue}
133133
and {!HeterogeneousHashedValue}.
134134
@@ -137,7 +137,7 @@ module MakeCustomHeterogeneousSet
137137
twice with same arguments will lead to two numbering systems for identifiers,
138138
and thus the types should not be considered compatible. *)
139139

140-
(** Hash-consed version of {!Sigs.MAP}. See {!hash_consed} for the differences between
140+
(** Hash-consed version of {!MAP}. See {!hash_consed} for the differences between
141141
hash-consed and non hash-consed maps.
142142
143143
This is a generative functor, as calling it creates a new hash-table to store
@@ -153,7 +153,7 @@ module MakeHashconsedMap(Key: KEY)(Value: HASHED_VALUE)() : sig
153153
include HASH_CONSED_OPERATIONS with type 'a t := 'a t (** @inline *)
154154
end
155155

156-
(** Hash-consed version of {!Sigs.SET}. See {!hash_consed} for the differences between
156+
(** Hash-consed version of {!SET}. See {!hash_consed} for the differences between
157157
hash-consed and non hash-consed sets.
158158
159159
This is a generative functor, as calling it creates a new hash-table to store
@@ -169,7 +169,7 @@ module MakeHashconsedSet(Key: KEY)() : sig
169169
include HASH_CONSED_OPERATIONS with type 'a t := t (** @inline *)
170170
end
171171

172-
(** Hash-consed version of {!Sigs.HETEROGENEOUS_SET}. See {!hash_consed} for the differences between
172+
(** Hash-consed version of {!HETEROGENEOUS_SET}. See {!hash_consed} for the differences between
173173
hash-consed and non hash-consed sets.
174174
175175
This is a generative functor, as calling it creates a new hash-table to store
@@ -185,7 +185,7 @@ module MakeHashconsedHeterogeneousSet(Key: HETEROGENEOUS_KEY)() : sig
185185
include HASH_CONSED_OPERATIONS with type 'a t := t (** @inline *)
186186
end
187187

188-
(** Hash-consed version of {!Sigs.HETEROGENEOUS_MAP}. See {!hash_consed} for the differences between
188+
(** Hash-consed version of {!HETEROGENEOUS_MAP}. See {!hash_consed} for the differences between
189189
hash-consed and non hash-consed maps.
190190
191191
This is a generative functor, as calling it creates a new hash-table to store

0 commit comments

Comments
 (0)