Module Ui_effect.Result

Result is extremely similar to Deferred.Result

type nonrec ('a, 'b) t = ('a, 'b) Base.Result.t t
include Base.Monad.S2 with type ('a, 'b) t := ('a, 'b) t
val return : 'a 'i 'p 'q. 'a -> ('a, 'p) t

Convert a value to a t.

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

Transforms the contents of a t.

val bind : 'a 'b 'i 'j 'k 'p 'q. ('a, 'p) t -> f:('a -> ('b, 'p) t) -> ('b, 'p) 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, 'p) t, 'p) t -> ('a, 'p) t

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

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

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

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

Combines a list of t.

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

Combines a list of t whose contents are unimportant.

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

Infix bind.

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

Infix map.

module Monad_infix : sig ... end
module Let_syntax : sig ... end
val fail : 'err -> (_, 'err) t
val combine : ('ok1, 'err) t -> ('ok2, 'err) t -> ok:('ok1 -> 'ok2 -> 'ok3) -> err:('err -> 'err -> 'err) -> ('ok3, 'err) t