Joins (flattens) nested Opt instance, turning an Opt<Opt<T>> into an Opt<T>. This is equivalent to calling flatMap with the identity function: .join() ~ .flatMap(id).
Opt<Opt<T>>
Opt<T>
flatMap
.join()
.flatMap(id)
const nestedOpt: Opt<Opt<number>> = opt(opt(42)); // Some(Some(42))const flattenedOpt: Opt<number> = nestedOpt.join(); // Some(42)
Joins (flattens) nested Opt instance, turning an
Opt<Opt<T>>
into anOpt<T>
. This is equivalent to callingflatMap
with the identity function:.join()
~.flatMap(id)
.