Module Preface_specs.Arrow

An Arrow is an abstract view of computation sitting between Applicative and Monad. Arrow is built on the top of Category and Strong. So an Arrow is also a Category.

Laws

To have a predictable behaviour, the instance of Arrow must obey some laws.

  1. All Category laws
  2. arrow id = id
  3. arrow (g % f) = arrow f >>> arrow g
  4. fst (arrow f) = arr (fst f)
  5. fst (f >>> g) = fst f >>> fst g
  6. fst f >>> arrow (fun (x,y) -> (x,g y)) = arrow (fun (x,y) -> (x,g y)) >>> fst f
  7. fst f >>> arrow Stdlib.fst = arrow Stdlib.fst >>> f
  8. fst (fst f) >>> arrow assoc = arrow assoc >>> fst f

Minimal definition

module type WITH_ARROW = sig ... end

Exposes the arrow function, mandatory for each requirement.

module type WITH_ARROW_AND_FST = sig ... end

Minimal definition using fst.

module type WITH_ARROW_AND_SPLIT = sig ... end

Minimal definition using split.

Structure anatomy

module type CORE = sig ... end

Basis operations.

module type OPERATION = sig ... end

Additional operations.

module type ALIAS = sig ... end

Aliases of some operations functions.

module type INFIX = sig ... end

Infix operators.

Complete API

module type API = sig ... end

The complete interface of an Arrow.

Additional references