Effects

Type-Driven Development of Communicating Systems using Idris

This week, I gave a talk about my work with Edwin Brady at University of St Andrews, whilst visiting Imperial College London for the Border Patrol Project. The talk was an extended version of my FP-Dag Talk, which was a revamp of my SPLS talk.

There is a disconnect between the tooling used to design, implement and reason about communication protocols and their implementations. Session Types are a typing discipline that help resolve this difference by allowing protocol specifications to be used during type-checking to ensure that implementations adhere to a given specification.

FP Dag 17-Type-Driven Design of Communicating Systems using Idris

Last week, I gave a talk about my work at FP Dag ‘17 https://msp-strath.github.io/spls-16/) at the annual meeting of functional programmers in the Netherlands. This year the meeting was in Nijmegen at the RU, where I did my Masters. Although I am not resident anymore in the Netherlands, I used the oppurtunity to talk about my work to an international audience, and to see old friends. The talk is a slight revamp of my SPLS talk.

SPLS-Type-Driven Design of Communicating Systems using Idris

Today I gave a talk about my work at SPLS Nov ‘16 at the University of Strathclyde.

The idea of communicating systems is a cornerstone of modern technology that allows heterogeneous collections of components to communicate through well-defined communication patterns. However, there is a disconnect between the tooling and languages used to design, implement and reason about communication protocols.

Idris is a general purpose programming language that supports full-dependent types, providing programmers with the ability to reason more precisely about programs. Inspired by work on Session types, our research looks to leverage dependent types to describe and reason about secure communication patterns and their implementation in different communication contexts.

Effectful Channel Management

Communicating systems require channels to communicate, in many of the programming languages that provide communication channels the management of these channels at the application layer is left to the programmer to get right. That is, the programmer is responsible for ensuring that the channel is established, connected to, and then destroyed.

In languages that support dependent types we can encoded, at the type level, extra properties about our software program. Further, the idea of algebraic effects supports the separation of a program’s description from its realisation in different contexts. Edwin Brady’s EFFECTS library has shown how this is possible using dependent types [@Brady2015rda]. The implementation of EFFECTS allows for efficient management of a program’s side-effects and dealings with the outside world. See the Effects Tutorial for more information.

Tips for using Effects in Idris

Effects is an Idris package that implements resource-dependent algebraic effects. This allows a developer to control at a fine-a-grained level the side affects (state, logging, IO) for effectful programs. A tutorial and more background on their use is available on line.

When writting my Idris libraries I have used Effects to manage exceptions, state, logging, and IO. Here are some tips in my experiences in using Effects.

Global Effects List

In an effectful function the effects used are declared in a List data structure of type List EFFECT. An effectful main function will look like:

An Effectful Logger: Part One

Effects is an Idris package that implements resource-dependent algebraic effects. This allows a developer to control at a fine-a-grained level the side affects (state, logging, IO) for effectful programs. A tutorial and more background on their use is available on line.

In the past I wrote some Logging effects as a means to understand how resource-dependent algebraic effects work. Recently, I had need to use it in anger in my application. As a result I rewrote the damm thing, and decided to describe the output in a blog post. This post will describe the simple logging model, with a future post describing the category based model.