Functional EDSLs for Web Applications
Doktorsavhandling, 2018

This thesis aims to make the development of complex web applications easier,
faster and safer through the application of strongly typed
functional programming techniques.

Traditional web applications are commonly written in the de facto standard
language of the web, JavaScript, which, being untyped, provides no guarantees
regarding the data processed by programs, increasing the burden of testing and
defensive programming.

Modern web applications are often highly complex, with multiple
interdependent parts interacting over the Internet.
Such applications are traditionally implemented with each component as a
separate program, exposing its functionality to other components through
different API:s over some communication protocol such as HTTP.

This process is mostly manual, and thus error-prone and labour intensive,
with accidental API incompatibility between components being particularly
Even in a conventional typed language, the absence of such incompatibilities
is not guaranteed.
While the different components may well be type-safe in isolation, there is no
guarantee that the whole is type-safe as the communication between components
is not type-checked.

We present a web application development framework, based on the Haskell
programming language, to increase programmer productivity and software quality
by addressing these issues.
In our framework, applications with an arbitrary number of components are
written, compiled and type-checked as a single program, guaranteeing that the
application as a whole, including network communication, is type-safe.
Communication between components is automatically generated by our framework,
eliminating the risk of API incompatibilities completely.

Additionally, our framework includes a
state-of-the-art compiler from Haskell to JavaScript,
a novel, lightweight foreign function interface to allow programs to leverage
existing JavaScript code, an embedded language for integrating low-level,
high-performance kernels into otherwise high-level web applications, as well as
a highly expressive relational database language.

functional programming

domain-specific programming languages

distributed systems

web applications

tierless programming languages

EB, EDIT-building, Hörsalsvägen 11, Chalmers
Opponent: Dr. Simon Peyton Jones, Microsoft Research, United Kingdom


Anton Ekblad

Chalmers, Data- och informationsteknik, Funktionell programmering

Foreign Exchange at Low, Low Rates

Proceedings of the 27th Symposium on the Implementation and Application of Functional Programming Languages,; Vol. 2015(2015)

Paper i proceeding

A seamless, client-centric programming model for type safe web applications

6th ACM SIGPLAN Haskell Symposium, Haskell 2014; Gothenburg; Sweden; 4 September 2014 through 5 September 2014,; (2014)p. 79-89

Paper i proceeding

A Meta-EDSL for Distributed Web Applications

SIGPLAN Notices (ACM Special Interest Group on Programming Languages),; Vol. 52(2017)p. 75-85

Paper i proceeding

High-Performance Web Applications through Haskell EDSLs

9th ACM SIGPLAN Haskell Symposium, Haskell 2016; Nara; Japan; 22 September 2016 through 23 September 2016,; (2016)p. 62-73

Paper i proceeding

In the real world,
we regularly deal with different types of things,
such as potatoes, painkillers, and batteries.
For most things, we know perfectly well how to deal with them safely: we eat
potatoes to sate our hunger, but not to get rid of headaches, and we put
batteries into flashlights and remote controls but we shouldn't eat them.
However, there are many, many, different things in the world, and not
all of them are equally easy to use safely.
For this reason, we have \emph{regulatory bodies} to classify different things
according to their use, and preventing anyone from marketing them
as something they are not.

Just like the real world, computer programs also contain a vast number of
different things -- data -- which all belong to some type.
Some computer languages act as a fully automated regulatory body,
to enforce that no data is used as though it were something completely
different -- using a picture as a number, for instance.
However, many computer languages don't have this regulatory body.
This leaves programmers free to experiment wildly with different ways to
combine data.
Just like you probably shouldn't trust your shady cousin -- who
swears that he's a totally great herbalist -- to make dinner
from a dozen suspicious mushrooms he happened to find on his way to your place,
you may want to think twice before relying on software written in the same way.
Just like with the dinner, unless the software in question was
perfectly prepared by highly skilled experts,
the consequences of consuming it may be dire indeed!

This thesis attempts to make the world of web applications a safer
place by regulating how data is used in ways which were
not previously possible.
Web applications consist of many different parts, which
talk to each other in a variety of ways.
Traditionally, parts can be seen as independent countries,
with their own regulatory bodies, engaging in a kind of international trade
with each other.
Each part could use different types of data safely on their own,
but as soon as they started communicating safety breaks down: the types of data
may not have the same definitions across parts, and some parts
may not even have a regulatory body at all.

The technologies pioneered by this thesis attempt to impose a sort of
multi-lateral trade agreement on parts, making communication
between them consistent and regulated.
Just like any two EU countries can trust that foodstuffs
exchanged between them is indeed considered edible in both,
web application parts can now trust that they have the same idea
of how any data they exchange should be used.
The end result? Safer programs for end users and less headache for software
developers, all through the magic of regulation!



Datavetenskap (datalogi)




Doktorsavhandlingar vid Chalmers tekniska högskola. Ny serie: 4373


Chalmers tekniska högskola

EB, EDIT-building, Hörsalsvägen 11, Chalmers

Opponent: Dr. Simon Peyton Jones, Microsoft Research, United Kingdom