Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save janekdb/70c892a4f6c3593aa09c974b19f72156 to your computer and use it in GitHub Desktop.
Save janekdb/70c892a4f6c3593aa09c974b19f72156 to your computer and use it in GitHub Desktop.
Scala Type Level Programming: The Natural Numbers: Multiplication Example
// 2 x 3 5 x 7 x 11 x 13 x 17 = 510510
type T510 = T5#mult[T10]#add[T1]#mult[T10]
type T510510 = T510#mult[T1000]#add[T510]
implicitly[T2#mult[T3]#mult[T5]#mult[T7]#mult[T11]#mult[T13]#mult[T17] =:= T510510]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment