mo
mo copied to clipboard
Fix the Map for Option type
After the first touch of Option type I was confused how the Map is implemented.
In my understanding of functional programming the Map should be applied only for a value and return the value, and never return the no-value.
For case when need to apply function for a value and return Some or None the FlatMap should be used.
Before:
Some(1).
Map(func(value int) (int, bool) {
return value + 21, true
})
After:
Some(1).
Map(func(value int) int {
return value + 21
})
Since this introduces a breaking change, we must wait for v2.