Re:Types as Interfaces
by harporoeder on Tuesday July 23, 2024 @09:48AM
(#41046002)
With dependent types you still end up having to do dynamic checking of invariants for a substantial portion of real world code to construct the value with the properties you want. Anything coming from disk or network or a database etc. In practice I feel that it is far easier to just do manual dynamic checking with the constructor hidden from other modules such as `constructEmail :: string -> Email' which uses normal value level code, a common Haskell pattern. Obviously a little less flexible for the common dependent type examples of such as appending two vectors of a specific length.
[ Parent
| on HN ]
You should be parsing/validating any value coming from disk or the network