Low Level Functional Reactive Programming

Lead Research Organisation: University of Warwick
Department Name: Computer Science

Abstract

In low level languages such as C, we rely heavily on the abstraction of memory - values are placed in a contiguous array of memory cells that can be referenced to and treated as data of any type. While this allows us to utilise a number of tools to improve program efficiency and easily interact with some hardware, it is a source of difficult to find bugs that can greatly reduce the reliability of such programs.

Much research has been done to mitigate these bugs. This work usually falls into one of two categories: adding safety to C (such as via linters), and adding C's features to safer languages. In order to do the latter, you need specific programming language constructs not normally found in our common high level languages. Languages entirely designed for this purpose, like Cyclone and Rust, have seen success in combining the constructs needed for interacting with memory with safety features such as region-based memory management and ownership.

Little has been done however to integrate this work with pure functional programming. This paradigm has seen improved uptake recently due to its naturally verifiable nature, but has difficulty interacting with low level programs due to the difference in paradigm. The main problem here is the fact that interacting with low level programs is time dependent - you have to access a memory cell during a certain part of execution in order to be given the value that you want - which in a functional paradigm relies on writing essentially imperative code.

This brings us to our approach. This time dependency can be avoided by considering our memory cell as a stream of values, that is, a sequence of values over time rather than single values accessed during execution. With this in mind, we can take our memory cell streams, perform a series of computations on them and write those out somewhere. As long as we have the stream, we have access to all the values in turn so sequencing is less of an issue.

There is a sizeable body of work about Functional Reactive Programming (FRP), a functional programming subparadigm designed to work with these streams. This paradigm allows us to take streams such as the ones above and combine them in order to construct a full signal graph.

By combining the existing work on FRP and the limited work on low level data use in functional programming, we propose an elegant alternative to current interfaces between functional languages and low level data. This aims to allow reactive applications that would previously require low level languages (such as in robotics) to be written in higher level languages more safely. This could also be used in other contexts, such as declaratively declaring shaders.

Publications

10 25 50

Studentship Projects

Project Reference Relationship Related To Start End Student Name
EP/T51794X/1 01/10/2020 30/09/2025
2436228 Studentship EP/T51794X/1 05/10/2020 31/03/2024 Finnbar Keating