The Maybe Monad in C#
The Maybe Monad is extremely simple. It represents a value that might be there, but might not, and also provides a neat way of working with such values.
This Haskell-related page makes it pretty clear:
The Maybe monad embodies the strategy of combining a chain of computations that may each return
Nothingby ending the chain early if any step producesNothingas output. It is useful when a computation entails a sequence of steps that depend on one another, and in which some steps may fail to return a value.
Change Nothing to null and we’re talking in C#. Furthermore, it advises:
Read more…
