4 ms·
Very useful indeed when you want a canonical or corrected (or otherwise "improved") version of a value and want to make sure that the original can't accidentall
by sixbrx 10y ago
Very useful indeed when you want a canonical or corrected (or otherwise "improved") version of a value and want to make sure that the original can't accidentally be used in what follows (which can be a hard to detect bug).
- eudox 10y agoYes, a common refinement pattern in code is (pseudocode): def fn(object): let object = predicate(object) ? modify(object) : error(); // do something with the refined object Or something along those lines.