FlatMap
thomassuckow opened this issue · 2 comments
thomassuckow commented
Would be nice if Map could take a function that also returns a nullable and have it 'do the right thing'
T2? T1?.Map<T1, T2>(Func<T1, T2> mapping)
T2? T1?.FlatMap<T1, T2>(Func<T1, T2?> mapping)
I think it could be an overload of Map, but I referred to it as flatmap since that is what Scala called the same operation.
thomassuckow commented
Of course it is called Bind
and I'm blind.
bert2 commented
If I had to do it again, I'd probably call it FlatMap()
instead of Bind()
. Even though I think Bind()
is "more correct", it is also less common and sounds a tad too generic...