4 ms·
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, a
by wtetzner 4y ago
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.