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

I believe that's what dependent types allow you to do.

However, even in weaker type systems you can get a similar effect by just creating a PrimeNumber type, and for functions that require a prime number, only accept PrimeNumber. Then any number you want to pass to those functions will have to go through PrimeNumber's constructor.



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

Search: