jon.recoil.org

Module Applicative.ComposeSource

Composes two applicatives, one nested inside the other.

Parameters

module Inner : sig ... end
module Outer : sig ... end

Signature

include Base.Applicative.S with type 'a t = 'a Inner.t Outer.t
type 'a t = 'a Inner.t Outer.t
val return : 'a 'p 'q. 'a -> 'a t

Convert a value to 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 map : 'a 'b 'p 'q. 'a t -> f:('a -> 'b) -> 'b t

Transforms the contents of a t. Using <*> as infix apply, equivalent to return f <*> t.

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 all : 'a 'p 'q. 'a t list -> 'a list t

Combines a list of t.

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

Combines a list of t whose contents are unimportant.

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
val (>>|) : 'a 'b 'p 'q. 'a t -> ('a -> 'b) -> 'b t
module Applicative_infix : sig ... end