Comment on Parse, don’t validate

Turun@feddit.de ⁨9⁩ ⁨months⁩ ago

So the core concept is that when you validate some property about input you should also transform the input into a new form that represents the new guarantee in the type system.

This is very, closely related to the “make invalid states unrepresentable” concept. If we have validated our list to be non empty, we should return a non empty list - after all an empty list is now invalid and as such the type system should exclude that possibility.

source
Sort:hotnewtop