5 ms·
Indeed, this seems to be just a case of newtypes. Newtypes are effective for any kind of value, not just numbers. newtype PostalCode = PostalCode String
by exceptione 2y ago
Indeed, this seems to be just a case of newtypes.
Newtypes are effective for any kind of value, not just numbers.
newtype PostalCode = PostalCode String
newtype LicenseKey = LicenseKey String
Now you won't be accidentally mixing postal codes and license keys. Every language should support newtypes (and algebraic types).
- Cthulhu_ 2y agoIt's definitely valuable in the domain layer of a business application, Typescript and Go support it as well.