Syntax Lookup

Enter some language construct you want to know more about.

module type

module type defines the required shape of a module.

Use module type to declare a module signature.

Example

ReScriptJS Output
module type Showable = {
  type t
  let show: t => string
}

module IntShow: Showable with type t = int = {
  type t = int
  let show = x => Int.toString(x)
}

let rendered = IntShow.show(42)

Type Constraints

Use with type to refine an abstract type from another module type. A private constraint exposes the underlying representation for safe coercion without allowing callers to construct values directly:

RES
module type Storage = { type t let make: string => t } module type PrivateStringStorage = Storage with type t = private string

References