Tuesday, February 21, 2012

Type-level programming

Some time ago I became interested in type-level programming in Scala. Subsequently I've spent quite some time surfing the web and looking for nice examples, projects, blog posts, discussions on SO, and more stuff like that.

Turns out there's a vast amount of information out there. However, it's spread all over the net. Hence I've created the following demo on basic type-level programming which aims at summing up the introductory steps. At this point, major thanks to Miles Sabin and Mark Harrah for sharing shapeless and/or their elaborate blog posts.

Apart from some explanatory slides the demo shows how to implement a type-level representation for natural numbers and arithmetics because that seemed to be an appropriate topic and, in case people were interested, they could easily find more information on the net.

You can download the slides here, and the full video is available here. Get the source code here.

Errata

  • When I checked the video I realised there's one major semantic "mischief" at or around time 15:35 where I said "successor of any other number" but really meant "successor of some other number" instead.

Please let me know if you happen to find any mistakes so that I can list them here.