package provider

  1. Overview
  2. Docs

Parametrize your OCaml library with values that behave like objects but aren't.

A "provider" is a construct that implements a set of functionality that an library typically needs in order to provide certain functionality to a client.

The module is divided into several submodules:

  • Trait: To identify and implement functionality.
  • Interface: Manages the set of traits that a provider implements.
  • Private: Used for testing purposes.

This module is inspired by the Eio.Resource module and provides a way to parameterize code when a library either doesn't want to or can't commit to a specific implementation.

module Trait : sig ... end
module Interface : sig ... end

Manipulating the set of traits implemented by a provider.

type -'tags t =
  1. | T : {
    1. t : 't;
    2. interface : ('t, 'tags) Interface.t;
    } -> 'tags t

A provider is a pair of a value and a set of traits that the provider implements.

module Private : sig ... end

This module is exported for testing purposes only.

OCaml

Innovation. Community. Security.