3 ms·
The point of input validation is to fail early, not to ensure the function executes. Returning an empty list when the input is an invalid list sounds like a re
by cptskippy 6y ago
The point of input validation is to fail early, not to ensure the function executes. Returning an empty list when the input is an invalid list sounds like a really bad idea.
What if the function is deleteWhereNotIn( list param )? That empty list just deleted everything.
- lambda_obrien 6y agoThe original article was in a Haskell context, where you'd use a Maybe or Either to prevent that sort of mistake.
- a1369209993 6y ago> The point of input validation is to fail early, not to ensure the function executes. > What if the function is deleteWhereNotIn( list param )? error: could not assign `param` = `mungeList foo` note: failed to match `List a` <= `Either SomeError (List b)` note: failed to match `List` <= `Either SomeError`