package accessor_base

  1. Overview
  2. Docs
include sig ... end
include sig ... end
val first : ('a -> 'b -> 'c, 'a -> ('b, 'd) Base.Either.t -> ('c, 'd) Base.Either.t, [< Accessor.variant ]) Accessor.t
val second : ('a -> 'b -> 'c, 'a -> ('d, 'b) Base.Either.t -> ('d, 'c) Base.Either.t, [< Accessor.variant ]) Accessor.t
val swapped : ('i -> ('a, 'b) Base.Either.t -> ('c, 'd) Base.Either.t, 'i -> ('b, 'a) Base.Either.t -> ('d, 'c) Base.Either.t, [< Accessor_base__.Import.isomorphism ]) Accessor.t

Access an either where the cases are swapped with each other.

assocl and assocr reassociate nested eithers.

val assocl : ('i -> (('a, 'b) Base.Either.t, 'c) Base.Either.t -> (('d, 'e) Base.Either.t, 'f) Base.Either.t, 'i -> ('a, ('b, 'c) Base.Either.t) Base.Either.t -> ('d, ('e, 'f) Base.Either.t) Base.Either.t, [< Accessor_base__.Import.isomorphism ]) Accessor.t
val assocr : ('i -> ('a, ('b, 'c) Base.Either.t) Base.Either.t -> ('d, ('e, 'f) Base.Either.t) Base.Either.t, 'i -> (('a, 'b) Base.Either.t, 'c) Base.Either.t -> (('d, 'e) Base.Either.t, 'f) Base.Either.t, [< Accessor_base__.Import.isomorphism ]) Accessor.t
module Index : sig ... end
val each : ('i -> 'a -> 'b, 'i -> ('a, 'a) Base.Either.t -> ('b, 'b) Base.Either.t, [< Accessor_base__.Import.field ]) Accessor.t

Access the value stored by the either, regardless of which constructor it lives under. This value is guaranteed to exist, so this accessor is a field instead of a variant.

val eachi : ((Index.t * 'i) -> 'a -> 'b, 'i -> ('a, 'a) Base.Either.t -> ('b, 'b) Base.Either.t, [< Accessor_base__.Import.field ]) Accessor.t

Like each, but also provides you with which constructor the value was under.

module First : Accessor.Monad.S2 with type ('a, 'b) t := ('a, 'b) Base.Either.t
module Second : Accessor.Monad.S2 with type ('a, 'b) t := ('b, 'a) Base.Either.t
OCaml

Innovation. Community. Security.