accessor

A library that makes it nicer to work with nested functional data structures
IN THIS PACKAGE
Parameter #1 Accessor . Optional . 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))