|
|
|
|
|
by fhars
1452 days ago
|
|
But then monads are a way to think about computations sequentially. If I write highly sequential code in a C-like language, in many cases most of the code is just boilerplate made necessary by the absence of native support for monads: int ret = doStepOne();
if (ret == RESULT_OK) {
ret = doStepTwo();
}
if (ret == RESULT_OK) {
ret = doStepThree();
}
return ret;
would just be doStepOne() >>= doStepTwo() >>= doStepThree()
in a language with support for monads. |
|