3 ms·
It would be specifically handled by the return type from validateData and the argument to ProcessData. It sounds clunky, but with an algebraic data type it woul
by CountSessine 16y ago
It would be specifically handled by the return type from validateData and the argument to ProcessData. It sounds clunky, but with an algebraic data type it would be fairly clean - just another pattern to match in ProcessData.
For a simple example like this, that might be the cleanest solution. For anything more complicated (like recursive descent parsing), a processing chain like this is an ideal application for a monad, where the binding between functions would be customized to avoid calling ProcessData altogether.