Haskell for Secure, Embedded, and Distributed Programming: High-level abstractions for low-level platforms
Doctoral thesis, 2026
Can Haskell's abstractions and compiler infrastructure target execution environments the language was not designed for, such as resource-constrained microcontrollers, trusted execution environments, and distributed systems?
The programming language Haskell has many appealing qualities: a type system that lets programmers state and check invariants, purity that lets them reason about program transformations, and abstractions that express their intent concisely. Compiled with GHC, Haskell achieves excellent performance, supported by an advanced runtime system.
That runtime, however, assumes a rich operating system and plentiful resources. A microcontroller offers neither, an enclave restricts which system services its code may use, and a distributed system needs to move computations between machines, something GHC cannot do. In each case, a boundary separates what Haskell expects from what the platform provides.
The four papers in this thesis move Haskell across this boundary with two complementary strategies. The first transforms the program before deployment. Scoria is an embedded language for real-time programs whose compiler generates C, so that microcontrollers run Haskell programs without hosting a Haskell runtime. HasTEE describes both sides of an enclave application in one program and uses the type system to partition it and to keep confidential data inside the enclave. The third paper extends partitioning to distributed programs with many participants, using only GHC's rewrite rules and specialisation. The second strategy adapts the runtime.
HasTEE combines the two strategies: its trusted part runs on a modified GHC runtime inside the enclave. CloudMicroHaskell builds on the MicroHs runtime, which represents code and data uniformly, to send computations between heterogeneous devices.
Together, the papers show that Haskell can target all three environments. The boundary does not disappear, but each paper makes it something the language, compiler, or runtime can manage.
Program Partitioning
Code Mobility
Haskell
Trusted Execution Environments
Embedded Programming
Functional Programming
Confidential Computing
Distributed Programming
Synchronous Programming
Author
Robert Krook
Chalmers, Computer Science and Engineering (Chalmers), Functional Programming
Creating a Language for Writing Real-Time Applications for the Internet of Things
2022 20th ACM-IEEE International Conference on Formal Methods and Models for System Design, MEMOCODE 2022,;(2022)
Paper in proceeding
HasTEE - Programming Trusted Execution Environments with Haskell
Haskell 2023 - Proceedings of the 16th ACM SIGPLAN International Symposium on Haskell, Co-located with ICFP 2023,;(2023)p. 72-88
Paper in proceeding
Welcome to the Parti(tioning) (Functional Pearl): Using Rewrite Rules and Specialisation to Partition Haskell Programs
Haskell 2024 - Proceedings of the 17th ACM SIGPLAN International Symposium on Haskell, Co-located with: ICFP 2024,;(2024)p. 27-40
Paper in proceeding
CloudMicroHaskell: Direct-Style Distributed Haskell via Runtime Graph Serialisation
Haskell 2026 Proceedings of the 19th ACM SIGPLAN International Symposium on Haskell Co Located with ICFP 2026,;(2026)p. 34-64
Paper in proceeding
The software for these devices is typically developed using languages positioned closely to the hardware, such as C. These are languages where developers need to manage many resources explicitly, where mistakes can easily happen. Such mistakes can cause devices to fail or expose confidential data, adding to the challenges of writing reliable software.
This thesis investigates how Haskell, a high-level programming language, can help programmers write software for small devices, process confidential data in protected environments, and coordinate computations across several computers. Haskell manages memory automatically, and its type system checks that different parts of a program fit together before the program runs. These features allow programmers to concentrate more on what their software should do.
The thesis develops tools that bring this approach to different computing environments. One lets programmers describe how a small device should react to events and translates that description into code the device can run. Others separate a program into parts that run in different places, including a protected environment for confidential computations. Another allows computers to exchange both data and the computations that operate on it, making distributed programs easier to express.
Together, these results demonstrate how Haskell’s abstractions and existing compiler tools can support programming small devices, protected environments, and distributed systems. The tools are research prototypes, but they show how programmers can retain useful language features while reaching hardware and systems that are difficult to program.
Octopi: Säker Programering för Sakernas Internet
Swedish Foundation for Strategic Research (SSF) (RIT17-0023), 2018-03-01 -- 2023-02-28.
Areas of Advance
Information and Communication Technology
Subject Categories (SSIF 2025)
Computer Sciences
Embedded Systems
DOI
10.63959/chalmers.dt/5953
ISBN
978-91-8103-496-7
Doktorsavhandlingar vid Chalmers tekniska högskola. Ny serie: 5953
Publisher
Chalmers
Room ED, of the EDIT building
Opponent: Gabriele Keller, Utrecht University, The Netherlands