Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The idea is to disallow altogether construction of invalid states, so you don't even need to write logic to catch bad data instances, or "convert integers to strings" (god forbid :-p). [1] gives a typical example of how this modeling may look like.

I think something like typedefs could be great in providing this kind of data modeling capabilities in languages where it ADTs are more tedious to write by hand.

1: https://fsharpforfunandprofit.com/posts/designing-with-types...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: