package preface

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Preface_stdlib.PairSource

Implementation for Pair.t.

Pair.t is the simplest product type. In addition to allowing the generic description of product types, it allows the description of a conjunction.

Type

Sourcetype ('a, 'b) t = 'a * 'b

Implementation

Bifunctor

module Bifunctor : Preface_specs.BIFUNCTOR with type ('a, 'b) t = ('a, 'b) t

Additional functions

Additional functions to facilitate practical work with Pair.t.

Sourceval fst : ('a, 'b) t -> 'a

Extract the first component of a pair.

Sourceval snd : ('a, 'b) t -> 'b

Extract the second component of a pair.

Sourceval swap : ('a, 'b) t -> ('b, 'a) t

Swap both components

Sourceval curry : (('a, 'b) t -> 'c) -> 'a -> 'b -> 'c

Convert a function which take a pair to a curried version.

Sourceval uncurry : ('a -> 'b -> 'c) -> ('a, 'b) t -> 'c

Convert a curried function to a function which take a pair.

Sourceval equal : ('a -> 'a -> bool) -> ('b -> 'b -> bool) -> ('a, 'b) t -> ('a, 'b) t -> bool

Equality between Pair.t.

Sourceval pp : (Format.formatter -> 'a -> unit) -> (Format.formatter -> 'b -> unit) -> Format.formatter -> ('a, 'b) t -> unit

Formatter for pretty-printing for Pair.t.

infix operators

Sourcemodule Infix : sig ... end
Sourceval (&) : 'a -> 'b -> ('a, 'b) t
OCaml

Innovation. Community. Security.