Quick GIST on how to encode natural numbers, at compile-time, in scala. This is obviously inspired in Shapeless’s implementation, but much simplified. Further from encoding of natural numbers, you can see encodings of sum, product and fatorial operations using implicits and dependent types.

Hopefully someone finds this useful :).


Comments

comments powered by Disqus