Functional programming provides a fundamental basis for reasoning about our programs and building out principled abstractions. However, it is not enough on its own and we also rely on other programming tools to aid in constructing programs correctly and efficiently. An advanced example of such a tool is dependent types; that is, types that depend on values. Dependent types can be used to provide strong guarantees about a program’s behaviour that are difficult or impossible to express with traditional type-systems.
Dependent types are gaining traction in mainstream FP languages such as Haskell (via language extensions) and Scala (via path-dependent sub-typing), but disappointingly, they are still less accessible to everyday programming than they can and should be. To help address this problem, Idris is a new programming language built from the ground up with the explicit goal of having better support for dependent types (as well as a number of other useful tools such as totality checking and tactic based theorem proving).
This talk will step through an end-to-end example in Idris, from fundamentals like building type-safe APIs, and performing IO through to building user interfaces. By the end of the talk we will have identified the strengths of this programming model, the practicalities of using them in Idris (in contrast to Scala and Haskell) and produced a battle-hardened, multi-player, tic-tac-toe game ready for production.
This talk was presented at YOW! LambdaJam 2014.