some<T, R> function

Maybe<R> some <T, R>(
  1. Maybe<T> self,
  2. R some(
    1. T val
    )
)

fMap

When it has Value Return Some(some(it))

otherwise return None

Implementation

Maybe<R> some<T, R>(Maybe<T> self, R some(T val)) {
  if (self is Some) {
    if (some != null) return Some(some(self.val));
  }
  return None();
}