Module Datatype_sig

module type S = sig ... end

Generic operations that must be provided by every data type.

module Undefined (Name : sig ... end) : sig ... end

If you do not want to define all datatype operations immediately.

Generic products and sums of bases

You an use this with conversion from records and sum types.

module Conv (B1 : S) (C : sig ... end) : S with type t = C.t

When a type t can be converted (ideally with an injection to B1.t), we can define its oprations in terms of those of B1

module Prod2 (B1 : S) (B2 : S) : S with type t = B1.t * B2.t
module Prod3 (B1 : S) (B2 : S) (B3 : S) : S with type t = B1.t * B2.t * B3.t
module Sum2 (BA : S) (BB : S) : S with type t = (BA.t, BB.t) Stdlib.Either.t
type ('a, 'b, 'c) sum3 =
  1. | Sum3A of 'a
  2. | Sum3B of 'b
  3. | Sum3C of 'c

Three constructor version of Either

module Sum3 (BA : S) (BB : S) (BC : S) : S with type t = (BA.t, BB.t, BC.t) sum3

Usual types and type operators

module Int : S with type t = int
module Unit : S with type t = unit
module String : S with type t = string
module Option (B : S) : sig ... end
module List (B : S) : sig ... end
module Set (B : S) : sig ... end
module Map (B : S) : sig ... end
module Hashtbl (B : S) : sig ... end
module StringMap : sig ... end
module StringHash : sig ... end