module type S = sig
.. end
type ('f, 's)
t =
| |
First of 'f |
| |
Second of 's |
This type represents values with two possibilities. Either
can be seen as a
generic sum type, the dual of Tuple
. First
is neither more important nor less
important than Second
.
val typerep_of_t : 'f Typerep_lib.Std.Typerep.t ->
's Typerep_lib.Std.Typerep.t ->
('f, 's) t Typerep_lib.Std.Typerep.t
val typename_of_t : 'f Typerep_lib.Std.Typename.t ->
's Typerep_lib.Std.Typename.t ->
('f, 's) t Typerep_lib.Std.Typename.t
include Invariant.S2
val swap : ('f, 's) t -> ('s, 'f) t
val value : ('a, 'a) t -> 'a
val iter : ('a, 'b) t -> first:('a -> unit) -> second:('b -> unit) -> unit
val value_map : ('a, 'b) t -> first:('a -> 'c) -> second:('b -> 'c) -> 'c
val map : ('a, 'b) t ->
first:('a -> 'c) -> second:('b -> 'd) -> ('c, 'd) t
val equal : ('f -> 'f -> bool) ->
('s -> 's -> bool) ->
('f, 's) t -> ('f, 's) t -> bool
module First: Either_intf.Focused
with type ('a, 'b) t = ('a, 'b) t
module Second: Either_intf.Focused
with type ('a, 'b) t = ('b, 'a) t
val is_first : ('a, 'b) t -> bool
val is_second : ('a, 'b) t -> bool
val first : 'f -> ('f, 'a) t
first
and second
are First.return
and Second.return
.
val second : 's -> ('a, 's) t
module Export: sig
.. end
module Stable: sig
.. end
val t_of_sexp : (Sexplib.Sexp.t -> 'f) ->
(Sexplib.Sexp.t -> 's) -> Sexplib.Sexp.t -> ('f, 's) t
val sexp_of_t : ('f -> Sexplib.Sexp.t) ->
('s -> Sexplib.Sexp.t) -> ('f, 's) t -> Sexplib.Sexp.t
val compare : ('f -> 'f -> int) ->
('s -> 's -> int) ->
('f, 's) t -> ('f, 's) t -> int
val bin_t : 'f Bin_prot.Type_class.t ->
's Bin_prot.Type_class.t -> ('f, 's) t Bin_prot.Type_class.t
val bin_read_t : 'f Bin_prot.Read.reader ->
's Bin_prot.Read.reader -> ('f, 's) t Bin_prot.Read.reader
val __bin_read_t__ : 'f Bin_prot.Read.reader ->
's Bin_prot.Read.reader ->
(int -> ('f, 's) t) Bin_prot.Read.reader
val bin_reader_t : 'f Bin_prot.Type_class.reader ->
's Bin_prot.Type_class.reader ->
('f, 's) t Bin_prot.Type_class.reader
val bin_size_t : 'f Bin_prot.Size.sizer ->
's Bin_prot.Size.sizer -> ('f, 's) t Bin_prot.Size.sizer
val bin_write_t : 'f Bin_prot.Write.writer ->
's Bin_prot.Write.writer -> ('f, 's) t Bin_prot.Write.writer
val bin_writer_t : 'f Bin_prot.Type_class.writer ->
's Bin_prot.Type_class.writer ->
('f, 's) t Bin_prot.Type_class.writer
first
and second
are First.return
and Second.return
.