|
|
|
|
|
by itishappy
684 days ago
|
|
You'll be keeping a lot more info in your head with your approach. For instance, the following illegal states have legal representations in your system: (null, null)
(result, new DivideByZeroException())
Hence your unhandled base case in the extension method. Sum types are a more accurate representation and more pleasant to use as a result.(btw, you're looking through the Monads For The Rest Of Us tutorial, but the the State Monad For The Rest Of Us tutorial is the one linked to this thread) |
|
The second case, if there is an exception, it would be handled as such by simply switching the order of the `if` in the extension method. None of this seems confusing nor onerous in day-to-day use.