Skip to main content

Maybe.maybe

maybedefaultfunction

Group: Metadata

Documentation

Applies the provided function to the contained value if it exists, otherwise returning the provided default value.

Arguments

  • default: The value to return if self is None. This value is lazy and hence will not execute any provided computation unless it is used.
  • function: The function to execute on the value inside the Some, if it is a just.

Examples

Apply a function over a Some value to get 4.

      import Standard.Base.Data.Maybe

example_maybe = Maybe.Some 2 . maybe 0 *2