diff --git a/benchs/run_benchs.ml b/benchs/run_benchs.ml index 9fb59a6c..c6a59626 100644 --- a/benchs/run_benchs.ml +++ b/benchs/run_benchs.ml @@ -432,9 +432,7 @@ module Tbl = struct let arg_make : type a. a key_type -> (module KEY with type t = a) * string = function | Int -> (module CCInt), "int" - | Str -> - let module S = struct type t = string include CCString end in - (module S : KEY with type t = string), "string" + | Str -> (module CCString : KEY with type t = string), "string" let sprintf = Printf.sprintf diff --git a/src/core/CCArray.ml b/src/core/CCArray.ml index eb525f64..44d93b16 100644 --- a/src/core/CCArray.ml +++ b/src/core/CCArray.ml @@ -18,6 +18,8 @@ type 'a printer = Format.formatter -> 'a -> unit (** {2 Arrays} *) +include Array + type 'a t = 'a array let empty = [| |] diff --git a/src/core/CCArray.mli b/src/core/CCArray.mli index 42ad6925..6676d1ed 100644 --- a/src/core/CCArray.mli +++ b/src/core/CCArray.mli @@ -13,6 +13,8 @@ type 'a printer = Format.formatter -> 'a -> unit (** {2 Arrays} *) +include module type of Array + type 'a t = 'a array val empty : 'a t diff --git a/src/core/CCArrayLabels.ml b/src/core/CCArrayLabels.ml index 85e152c8..f6573cb8 100644 --- a/src/core/CCArrayLabels.ml +++ b/src/core/CCArrayLabels.ml @@ -18,6 +18,8 @@ type 'a printer = Format.formatter -> 'a -> unit (** {2 Arrays} *) +include ArrayLabels + type 'a t = 'a array let empty = [| |] diff --git a/src/core/CCArrayLabels.mli b/src/core/CCArrayLabels.mli index 36f3d4ea..fdf3784b 100644 --- a/src/core/CCArrayLabels.mli +++ b/src/core/CCArrayLabels.mli @@ -13,6 +13,8 @@ type 'a printer = Format.formatter -> 'a -> unit (** {2 Arrays} *) +include module type of ArrayLabels + type 'a t = 'a array val empty : 'a t diff --git a/src/core/CCChar.ml b/src/core/CCChar.ml index 848594a0..55900bd6 100644 --- a/src/core/CCChar.ml +++ b/src/core/CCChar.ml @@ -4,10 +4,9 @@ @since 0.14 *) -type t = char +include Char let equal (a:char) b = a=b -let compare = Char.compare let pp = Buffer.add_char let print = Format.pp_print_char diff --git a/src/core/CCChar.mli b/src/core/CCChar.mli index 55ebca0d..2100a900 100644 --- a/src/core/CCChar.mli +++ b/src/core/CCChar.mli @@ -4,7 +4,7 @@ @since 0.14 *) -type t = char +include module type of Char val equal : t -> t -> bool val compare : t -> t -> int diff --git a/src/core/CCList.ml b/src/core/CCList.ml index 6861d538..82eb60a9 100644 --- a/src/core/CCList.ml +++ b/src/core/CCList.ml @@ -9,6 +9,8 @@ type 'a t = 'a list +include List + let empty = [] let is_empty = function diff --git a/src/core/CCList.mli b/src/core/CCList.mli index f90ddef8..4a5138d6 100644 --- a/src/core/CCList.mli +++ b/src/core/CCList.mli @@ -9,6 +9,8 @@ type 'a klist = unit -> [`Nil | `Cons of 'a * 'a klist] type 'a printer = Format.formatter -> 'a -> unit type 'a random_gen = Random.State.t -> 'a +include module type of List + type 'a t = 'a list val empty : 'a t diff --git a/src/core/CCListLabels.ml b/src/core/CCListLabels.ml index d5bb6fad..61df2913 100644 --- a/src/core/CCListLabels.ml +++ b/src/core/CCListLabels.ml @@ -7,6 +7,8 @@ let lsort l = List.sort Pervasives.compare l *) +include ListLabels + type 'a t = 'a list let empty = [] diff --git a/src/core/CCListLabels.mli b/src/core/CCListLabels.mli index bfa81d21..09125956 100644 --- a/src/core/CCListLabels.mli +++ b/src/core/CCListLabels.mli @@ -3,6 +3,8 @@ (** {1 complements to list} *) +include module type of ListLabels + type 'a t = 'a list val empty : 'a t diff --git a/src/core/CCRandom.ml b/src/core/CCRandom.ml index be36f30e..bcc83111 100644 --- a/src/core/CCRandom.ml +++ b/src/core/CCRandom.ml @@ -3,6 +3,8 @@ (** {1 Random Generators} *) +include Random + type state = Random.State.t type 'a t = state -> 'a diff --git a/src/core/CCRandom.mli b/src/core/CCRandom.mli index e43da782..ffb32cfb 100644 --- a/src/core/CCRandom.mli +++ b/src/core/CCRandom.mli @@ -3,6 +3,8 @@ (** {1 Random Generators} *) +include module type of Random + type state = Random.State.t type 'a t = state -> 'a diff --git a/src/core/CCString.cppo.ml b/src/core/CCString.cppo.ml index 9592a53d..a4c66419 100644 --- a/src/core/CCString.cppo.ml +++ b/src/core/CCString.cppo.ml @@ -7,6 +7,8 @@ type 'a gen = unit -> 'a option type 'a sequence = ('a -> unit) -> unit type 'a klist = unit -> [`Nil | `Cons of 'a * 'a klist] +include String + module type S = sig type t diff --git a/src/core/CCString.mli b/src/core/CCString.mli index ca640222..5cfc2599 100644 --- a/src/core/CCString.mli +++ b/src/core/CCString.mli @@ -48,6 +48,8 @@ end (** {2 Strings} *) +include module type of String + val equal : string -> string -> bool val compare : string -> string -> int diff --git a/src/core/containers.ml b/src/core/containers.ml index 399cee45..6c3234b5 100644 --- a/src/core/containers.ml +++ b/src/core/containers.ml @@ -1,25 +1,10 @@ (* This file is free software, part of containers. See file "license" for more details. *) -(** {1 Drop-In replacement to Stdlib} +(** {1 Drop-In replacement to Stdlib} *) - This module is meant to be opened if one doesn't want to use both, say, - [List] and [CCList]. Instead, [List] is now an alias to - {[struct - include List - include CCList - end - ]} -*) - -module Array = struct - include Array - include CCArray -end -module ArrayLabels = struct - include ArrayLabels - include CCArrayLabels -end +module Array = CCArray +module ArrayLabels = CCArrayLabels module Array_slice = CCArray_slice module Bool = CCBool module Char = struct @@ -50,14 +35,8 @@ module Hashtbl = struct module Make' = CCHashtbl.Make end module Heap = CCHeap -module List = struct - include List - include CCList -end -module ListLabels = struct - include ListLabels - include CCListLabels -end +module List = CCList +module ListLabels = CCListLabels module Map = struct module type OrderedType = Map.OrderedType include CCMap @@ -66,10 +45,7 @@ module Option = CCOpt module Ord = CCOrd module Pair = CCPair module Parse = CCParse -module Random = struct - include Random - include CCRandom -end +module Random = CCRandom module Ref = CCRef module Result = struct include Result @@ -79,8 +55,5 @@ module Set = struct module type OrderedType = Set.OrderedType include CCSet end -module String = struct - include String - include CCString -end +module String = CCString module Vector = CCVector