package tezos-test-helpers

  1. Overview
  2. Docs

Applicative extends Functor with an map2 and return method, allowing us to lift functions of arbitrary arity.

We can define and+ in terms of map2 and vice versa:

let (and+) = map2 (fun x y -> (x,y))

let map2 f x y =
  let+ a = x
  and+ b = y in
  f x y

assuming

(and+) = product

and

(let+) x f = map f x .

An Applicative should satisfy:

  • Associativity: product (product x y) z = product x (product y z)
  • Identities: product (return ()) x = x = product x (return ())
module type S = sig ... end