module Container: Container
module type T =sig
..end
val fold_count : ('a -> init:int -> f:(int -> 'b -> int) -> 'c) -> 'a -> f:('b -> bool) -> 'c
module Make:
Container.Make
is to bind the resulting module and to explicitly
import each of the functions that one wants:
module type S0 =sig
..end
module type S0_phantom =sig
..end
module type S1 =sig
..end
module type S1_phantom =sig
..end
module type S1_phantom_invariant =sig
..end
module type Generic =sig
..end
module type Generic_phantom =sig
..end
module Check:
module Check_S0:
module Check_S0_phantom:
module Check_S1:
type
phantom
module Check_S1_phantom:functor (
M
:
S1_phantom
) ->
Check
(
sig
type'a
t =('a, Container.phantom) M.t
end
)
(
sig
type'a
t ='a
end
)
(
M
)
module Check_S1_phantom_invariant:functor (
M
:
S1_phantom_invariant
) ->
Check
(
sig
type'a
t =('a, Container.phantom) M.t
end
)
(
sig
type'a
t ='a
end
)
(
M
)
Container.Make
is to bind the resulting module and to explicitly
import each of the functions that one wants:
module C = Container.Make (struct ... end)
let count = C.count
let exists = C.exists
let find = C.find
...
This is preferable to:
include Container.Make (struct ... end)
because the include
makes it to easy to shadow specialized implementations of
container functions (length
being a common one).
Container.Make
implements iter
in terms of fold
, which is often slower than
implementing iter
directly.