Module Base.Applicative

Applicatives model computations in which values computed by subcomputations cannot affect what subsequent computations will take place. Relative to monads, this restriction takes power away from the user of the interface and gives it to the implementation. In particular, because the structure of the entire computation is known, one can augment its definition with some description of that structure.

For more information, see:

      Applicative Programming with Effects.
      Conor McBride and Ross Paterson.
      Journal of Functional Programming 18:1 (2008), pages 1-13.
      http://staff.city.ac.uk/~ross/papers/Applicative.pdf
    
module type Basic : sig ... end
module type S : sig ... end
module type Args : sig ... end

argument lists and associated N-ary map and apply functions

module type Basic2 : sig ... end
module type S2 : sig ... end
module S_to_S2 = Applicative_intf.S_to_S2

This module serves mostly as a partial check that S2 and S are in sync, but actually calling it is occasionally useful.

module S2_to_S = Applicative_intf.S2_to_S
module type Args2 : sig ... end
module Args_to_Args2 = Applicative_intf.Args_to_Args2
module Make : functor (X : Basic) -> S with type t := a X.t
module Make2 : functor (X : Basic2) -> S2 with type (a, e) t := (a, e) X.t
module Make_args : functor (X : S) -> Args with type arg := a X.t
module Make_args2 : functor (X : S2) -> Args2 with type (a, e) arg := (a, e) X.t

The following functors give a sense of what Applicatives one can define.

Of these, Of_monad is likely the most useful. The others are mostly didactic.

module Of_monad : functor (M : Monad.S) -> S with type t := a M.t

Every monad is Applicative via:

module Compose : functor (F : S) -> functor (G : S) -> S with type 'a t = 'a F.t G.t
module Pair : functor (F : S) -> functor (G : S) -> S with type 'a t = 'a F.t * 'a G.t
module Const : functor (Monoid : sig ... end) -> S with type 'a t = Monoid.t

Every monoid gives rise to a constant Applicative.