Reduces the Opt instance to a single value by applying a function to the value inside Some or returning a default value for None.
Opt
Function to apply to the value inside Some.
Some
Default value to return for None.
None
opt(1).fold(x => x + 1, 0) // 2none.fold(x => x + 1, 0) // 0
Reduces the
Opt
instance to a single value by applying a function to the value inside Some or returning a default value for None.