logoalt Hacker News

mkehrt • yesterday at 8:22 PM • 1 reply • view on HN

Aha, thanks!


Replies

n923263 • yesterday at 9:23 PM

A good mnemonic is that that if X and Y are finite types[0], sum, product and exponent types are just doing the relevant arithmetic on the types.

(Bool->Bool,Uint8+()) is just a verbose way of saying (2^2 * (256+1)), where 1,2, and 256 are types with the appropriate number of elements.

The cases involving infinite types are just a (straightforward?) generalization of that.

0: eg 0=noreturn [1],1=void,2=Bool,256=uint8_t

1: Much like in set theory, zero is the empty set.