package accessor

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

Parameter Make_access.T

type ('a, 'b) t
val optional : ('at -> ('a * ('b -> 'bt), 'bt) Base.Either.t) -> ('a, 'b) t -> ('at, 'bt) t

A legal implementation of this function must satisfy the following properties:

  optional (fun a -> First (a, Fn.id)) = Fn.id
  Fn.compose (optional f) (optional g)
  =
  optional (fun a ->
    match f a with
    | Second _ as a -> a
    | First (a, j) ->
      match g a with
      | First (a, k) -> First (a, Fn.compose j k)
      | Second a -> Second (j a))
OCaml

Innovation. Community. Security.