module Stdlib.Data.Maybe.Base;

import Juvix.Builtin.V1.Maybe open public;

--- Extracts the value from a ;Maybe; if present, else returns the given value.
{-# inline: true #-}
fromMaybe {A} (a : A) : Maybe A  A
  | nothing := a
  | (just a) := a;

--- Applies a function to the value from a ;Maybe; if present, else returns the
--- given value.
{-# inline: true #-}
maybe {A B} (b : B) (f : A  B) : Maybe A  B
  | nothing := b
  | (just a) := f a;
Last modified on 2024-05-06 3:17 UTC