Pattern Matching for Non-inductive Types in Code-generating Haskell EDSLs
Sammanfattning
Internet of Things (IoT) devices are becoming increasingly common in the modern
home, as are IoT-related security vulnerabilities. There are reasons to believe that
many of these vulnerabilities were caused by programming errors made possible due
to working in a low-level programming language. The embedded domain-specific
language (EDSL) Haski provides a way to write low-level applications in the highlevel functional programming language Haskell.
An embedded language inherits many features of its host language with little
effort, but some have proven to be more difficult to utilize than others. Haskell’s
built-in pattern matching is one of its killer features, but also one that is hard to
properly integrate into an embedded language. We explore how pattern matching
can be implemented in deeply-embedded Haskell EDSLs like Haski, and investigate
how to work around fundamental difficulties of pattern matching embedding. We
first demonstrate the limits of the current pattern matching solution in Haski and
then present the process used to develop the resulting pattern matching framework,
including issues encountered and how they were solved. We argue that the framework is applicable to EDSLs with a deeply-embedded design in general, and we
integrate the framework into an existing Haski compiler.
Examinationsnivå
Student essay
Samlingar
Fil(er)
Datum
2021-09-20Författare
Li, Thomas
Nyckelord
haskell
haski
edsl
pattern matching
embedded domain-specific languages
functional programming
Språk
eng