code: function maybe(x) {
      return function(f) {
        return function(maybe) {
          return maybe.isJust ? f (maybe.value) : x;
        };
      };
    }
docs: # maybe :: b -> (a -> b) -> Maybe a -> b . . Takes a value of any type, a function, and a Maybe. If the Maybe is . a Just, the return value is the result of applying the function to . the Just's value. Otherwise, the first argument is returned. . . See also [`maybe_`](#maybe_). . . ```javascript . > S.maybe (0) (S.prop ('length')) (S.Just ('refuge')) . 6 . . > S.maybe (0) (S.prop ('length')) (S.Nothing) . 0 . ```