Dependently Typed State Machines

Dependently Typed State Machines

State machines naturally occur in software systems we write, with many components reling on state as a core principle. We use state machines to describe things like TCP/IP networking, distributed algorithms and everyones favourite regular expressions.
Think about things as simple as network sockets or database connections, these are implicitly stateful. It only makes sense to perform a read on a socket that is open and has data available. Likewise you can't send an SQL statement to a closed database connection.

State machines also occur naturally in various protocols like distributed consenseus algorithms like PAXOS or RAFT.

Despite the ubiquity of state machines they aren't typically checked by compilers even in strongly typed languages like Haskell or OCaml.

In this talk we will look at approaches to using dependent typing to provide extra safety in encoding state machines, using both Haskell and Idris. And look at how we can introduce dependent types into our code without making the types incomprehensible and difficult to work with.

The talk is aimed at intermediate level programmers with a familarity with a typed programming langauge like Haskell, Idris or OCaml, and aims to provide a motivation for using dependent types in a practical setting. When new techniques and ideas occur in academia it is important that they are investigated and evaluated in a pragmatic way. Only introducing new things if they provide real and measurable benefits. I would like people to get an appreciation of what dependent types could do and how to critially think about new features in a language.

67afd2b4c98c9befd18c19f0ee9d94dc?s=128

Tim McGilchrist

August 27, 2018
Tweet