accessor

A library that makes it nicer to work with nested functional data structures
IN THIS PACKAGE
Parameter #1 Accessor . Variant . Make_access . T
type ('a, 'b) t
val variant : match_:( 'at -> ( 'a, 'bt ) Base.Either.t ) -> construct:( 'b -> 'bt ) -> ( 'a, 'b ) t -> ( 'at, 'bt ) t

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

variant ~match_:Either.first ~construct:Fn.id = Fn.id
Fn.compose
  (variant ~match_:m1 ~construct:c1)
  (variant ~match_:m2 ~construct:c2)
=
variant
  ~match_:(fun a ->
    match m1 a with
    | Second _ as a -> a
    | First a ->
      match m2 a with
      | First _ as a -> a
      | Second a -> Second (c1 a))
  ~construct:(Fn.compose c1 c2)