package mechaml

  1. Overview
  2. Docs

Module Mechaml.OptionSource

Helpers for the option Monad

Monadic operations

Sourceval return : 'a -> 'a option
Sourceval bind : 'a option -> ('a -> 'b option) -> 'b option
Sourceval join : 'a option option -> 'a option
Sourceval map : ('a -> 'b) -> 'a option -> 'b option
Sourceval map_pair : ('a option * 'b option) -> ('a -> 'b -> 'c) -> 'c option

Apply a two arguments function to a pair of optionals : if one of the component is None, the result is None, otherwise map2 (Some x, Some y) f is Some (f x y)

Sourceval default : 'a option -> 'a -> 'a

Return the content of an optional, or the given default value if the first argument is None.

Sourcemodule Infix : sig ... end
OCaml

Innovation. Community. Security.