module Core_set_intf:sig
..end
Core.Std.Set
. This module uses the same
organizational approach as Core_map_intf
. See the documentation in core_map.mli for
a description of the approach.
This module defines module types
{Creators,Accessors}{0,1,2,_generic,_with_comparator}
. It uses check functors to
ensure that each module types is an instance of the corresponding _generic
one.
We must treat Creators
and Accessors
separately, because we sometimes need to
choose different instantiations of their options
. In particular, Set
itself
matches Creators2_with_comparator
but Accessors2
(without comparator).
Core.Std.Set
. This module uses the same
organizational approach as Core_map_intf
. See the documentation in core_map.mli for
a description of the approach.
This module defines module types
{Creators,Accessors}{0,1,2,_generic,_with_comparator}
. It uses check functors to
ensure that each module types is an instance of the corresponding _generic
one.
We must treat Creators
and Accessors
separately, because we sometimes need to
choose different instantiations of their options
. In particular, Set
itself
matches Creators2_with_comparator
but Accessors2
(without comparator).
module Binable: Binable0
module type Elt = Comparator.Pre
module type Elt_binable = Comparator.Pre_binable
module Without_comparator: Core_map_intf.Without_comparator
module With_comparator: Core_map_intf.With_comparator
module type Accessors_generic =sig
..end
module type Accessors0 =sig
..end
module type Accessors1 =sig
..end
module type Accessors2 =sig
..end
module type Accessors2_with_comparator =sig
..end
module Check_accessors:functor (
T
:
T.T2
) ->
functor (
Tree
:
T.T2
) ->
functor (
Elt
:
T.T1
) ->
functor (
Options
:
T.T3
) ->
functor (
M
:
Accessors_generic
with type ('a, 'b, 'c) options := ('a, 'b, 'c) Options.t
with type ('a, 'b) t := ('a, 'b) T.t
with type ('a, 'b) tree := ('a, 'b) Tree.t
with type 'a elt := 'a Elt.t
) ->
sig
..end
module Check_accessors0:functor (
M
:
Accessors0
) ->
Check_accessors
(
sig
type('a, 'b)
t =M.t
end
)
(
sig
type('a, 'b)
t =M.tree
end
)
(
sig
type'a
t =M.elt
end
)
(
Without_comparator
)
(
M
)
module Check_accessors1:functor (
M
:
Accessors1
) ->
Check_accessors
(
sig
type('a, 'b)
t ='a M.t
end
)
(
sig
type('a, 'b)
t ='a M.tree
end
)
(
sig
type'a
t ='a
end
)
(
Without_comparator
)
(
M
)
module Check_accessors2:functor (
M
:
Accessors2
) ->
Check_accessors
(
sig
type('a, 'b)
t =('a, 'b) M.t
end
)
(
sig
type('a, 'b)
t =('a, 'b) M.tree
end
)
(
sig
type'a
t ='a
end
)
(
Without_comparator
)
(
M
)
module Check_accessors2_with_comparator:functor (
M
:
Accessors2_with_comparator
) ->
Check_accessors
(
sig
type('a, 'b)
t =('a, 'b) M.t
end
)
(
sig
type('a, 'b)
t =('a, 'b) M.tree
end
)
(
sig
type'a
t ='a
end
)
(
With_comparator
)
(
M
)
module type Creators_generic =sig
..end
module type Creators0 =sig
..end
module type Creators1 =sig
..end
module type Creators2 =sig
..end
module type Creators2_with_comparator =sig
..end
module Check_creators:functor (
T
:
T.T2
) ->
functor (
Tree
:
T.T2
) ->
functor (
Elt
:
T.T1
) ->
functor (
Options
:
T.T3
) ->
functor (
M
:
Creators_generic
with type ('a, 'b, 'c) options := ('a, 'b, 'c) Options.t
with type ('a, 'b) t := ('a, 'b) T.t
with type ('a, 'b) tree := ('a, 'b) Tree.t
with type 'a elt := 'a Elt.t
) ->
sig
..end
module Check_creators0:functor (
M
:
Creators0
) ->
Check_creators
(
sig
type('a, 'b)
t =M.t
end
)
(
sig
type('a, 'b)
t =M.tree
end
)
(
sig
type'a
t =M.elt
end
)
(
Without_comparator
)
(
M
)
module Check_creators1:functor (
M
:
Creators1
) ->
Check_creators
(
sig
type('a, 'b)
t ='a M.t
end
)
(
sig
type('a, 'b)
t ='a M.tree
end
)
(
sig
type'a
t ='a
end
)
(
Without_comparator
)
(
M
)
module Check_creators2:functor (
M
:
Creators2
) ->
Check_creators
(
sig
type('a, 'b)
t =('a, 'b) M.t
end
)
(
sig
type('a, 'b)
t =('a, 'b) M.tree
end
)
(
sig
type'a
t ='a
end
)
(
Without_comparator
)
(
M
)
module Check_creators2_with_comparator:functor (
M
:
Creators2_with_comparator
) ->
Check_creators
(
sig
type('a, 'b)
t =('a, 'b) M.t
end
)
(
sig
type('a, 'b)
t =('a, 'b) M.tree
end
)
(
sig
type'a
t ='a
end
)
(
With_comparator
)
(
M
)
module type Creators_and_accessors_generic =sig
..end
module type Creators_and_accessors0 =sig
..end
module type Creators_and_accessors1 =sig
..end
module type Creators_and_accessors2 =sig
..end
module type Creators_and_accessors2_with_comparator =sig
..end
module type S0 =sig
..end
module type S0_binable =sig
..end
Core.Std.Set
. This module uses the same
organizational approach as Core_map_intf
. See the documentation in core_map.mli for
a description of the approach.
This module defines module types
{Creators,Accessors}{0,1,2,_generic,_with_comparator}
. It uses check functors to
ensure that each module types is an instance of the corresponding _generic
one.
We must treat Creators
and Accessors
separately, because we sometimes need to
choose different instantiations of their options
. In particular, Set
itself
matches Creators2_with_comparator
but Accessors2
(without comparator).
The types of map
and filter_map
are subtle. The input set, ('a, _) set
,
reflects the fact that these functions take a set of *any* type, with any
comparator, while the output set, ('b, 'cmp) t
, reflects that the output set has
the particular 'cmp
of the creation function. The comparator can come in one of
three ways, depending on which set module is used
Set.map
-- comparator comes as an argumentSet.Poly.map
-- comparator is polymorphic comparisonFoo.Set.map
-- comparator is Foo.comparator