As well as being functions, set are values. You can apply functions to them, pass them around, etc.
Wait, what is {1,2} + 2, you ask?
Simple: it is just {1+2,2+2}={3,4}.

Similarly, {...,-3,-2,-1,0,1,2,3,...} * {2,3} = {...,-9,-8,-6,-4,-3,-2,0,2,3,4,6,8,9,...}.
It’s just that set monad or ambiguous choice that you thought might be cool.

But sets are types, so this means you can do type-level arithmetic; (2 * Integer) * 3 = (6 * Integer)
Of course, this probably makes the type system undecidable… but I certainly don’t care!

Advertisements