Module Ui_effect.Or_error

Like Result above, this is extremely similar to Deferred.Or_error. A lot of the additional functions are missing, but can be added as needed

type nonrec 'a t = 'a Base.Or_error.t t
include Base.Applicative.S with type 'a t := 'a t
val apply : 'a 'b 'p 'q. ('a -> 'b) t -> 'a t -> 'b t

Applies the functions in one t to the values in another. Well-behaved applicatives satisfy these "laws", using <*> as infix apply:

  • return Fn.id <*> t is equivalent to t
  • return Fn.compose <*> tf <*> tg <*> tx is equivalent to tf <*> (tg <*> tx)
  • return f <*> return x is equivalent to return (f x)
  • tf <*> return x is equivalent to return (fun f -> f x) <*> tf
val both : 'a 'b 'p 'q. 'a t -> 'b t -> ('a * 'b) t

Combines values in two ts as tuples. Using <*> as infix apply, equivalent to return (fun a b -> a, b) <*> ta <*> tb.

val map2 : 'a 'b 'c 'p 'q. 'a t -> 'b t -> f:('a -> 'b -> 'c) -> 'c t

Combines the contents of two ts. Using <*> as infix apply, equivalent to return f <*> ta <*> tb.

val map3 : 'a 'b 'c 'd 'p 'q. 'a t -> 'b t -> 'c t -> f:('a -> 'b -> 'c -> 'd) -> 'd t

Combines the contents of three ts. Using <*> as infix apply, equivalent to return f <*> ta <*> tb <*> tc.

val (<*>) : 'a 'b 'p 'q. ('a -> 'b) t -> 'a t -> 'b t
val (<*) : 'a 'p 'q. 'a t -> unit t -> 'a t
val (*>) : 'a 'p 'q. unit t -> 'a t -> 'a t
module Applicative_infix : sig ... end
include Base.Monad.S with type 'a t := 'a t
val return : 'a 'i 'p 'q. 'a -> 'a t

Convert a value to a t.

val map : 'a 'b 'i 'j 'p 'q. 'a t -> f:('a -> 'b) -> 'b t

Transforms the contents of a t.

val bind : 'a 'b 'i 'j 'k 'p 'q. 'a t -> f:('a -> 'b t) -> 'b t

Sequences computations. bind t ~f computes f v for value(s) v in t. Well-behaved monads satisfy these "laws" (where ( >>= ) is the infix bind operator):

  • map t ~f is equivalent to bind t ~f:(fun x -> return (f x))
  • return x >>= f is equivalent to f x
  • t >>= return is equivalent to t
  • (t >>= f) >>= g is equivalent to t >>= fun x -> f x >>= g
val join : 'a 'i 'j 'k 'p 'q. 'a t t -> 'a t

Combines nested t into just one layer. Equivalent to bind t ~f:Fn.id.

val ignore_m : 'a 'i 'j 'p 'q. 'a t -> unit t

Ignores contained values of t. Equivalent to map t ~f:ignore.

val all : 'a 'i 'p 'q. 'a t list -> 'a list t

Combines a list of t.

val all_unit : 'i 'p 'q. unit t list -> unit t

Combines a list of t whose contents are unimportant.

val (>>=) : 'a 'b 'i 'j 'k 'p 'q. 'a t -> ('a -> 'b t) -> 'b t

Infix bind.

val (>>|) : 'a 'b 'i 'j 'p 'q. 'a t -> ('a -> 'b) -> 'b t

Infix map.

module Monad_infix : sig ... end
module Let_syntax : sig ... end
val fail : Base.Error.t -> _ t
val error : Base.string -> 'a -> ('a -> Base.Sexp.t) -> _ t
val error_s : Base.Sexp.t -> _ t
val error_string : Base.string -> _ t