package preface

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Alternative is a kind of Monoid on Applicative. An Alternative is formally an Applicative with neutral and combine. So an Alternative is also an Applicative (and an Alt which is also a Functor).

Laws

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

  1. All Applicative laws
  2. All Alt laws
  3. combine x neutral = combine neutral x = x

Minimal definition

module type WITH_NEUTRAL_AND_COMBINE = sig ... end

Minimal interfaces of Alternative without Applicative.

module type WITH_MAP_AND_PRODUCT = sig ... end

Minimal definition using neutral, combine, pure, map and product.

module type WITH_APPLY = sig ... end

Minimal definition using neutral, combine, pure and apply.

module type WITH_LIFT2 = sig ... end

Minimal definition using neutral, combine, pure and lift2.

Structure anatomy

module type CORE = sig ... end

Basis operations.

module type ALTERNATIVE_OPERATION = sig ... end

Operation without Applicative.

module type OPERATION = sig ... end

Additional operations.

module type INFIX = sig ... end

Infix operators.

module type SYNTAX = sig ... end

Syntax extensions.

Complete API

module type API = sig ... end

The complete interface of an Alternative.

Additional references

OCaml

Innovation. Community. Security.