Haskell Substitution Stepper (BA)

Elvedi, Robin and Dietler, Dominik (2022) Haskell Substitution Stepper (BA). Other thesis, OST Ostschweizer Fachhochschule.

[thumbnail of HS 2021 2022-BA-EP-Elvedi-Dietler-Haskell Substitution Stepper.pdf] Text
HS 2021 2022-BA-EP-Elvedi-Dietler-Haskell Substitution Stepper.pdf - Supplemental Material

Download (6MB)


Functional programming languages such as Haskell are fundamentally different from imperative languages. While Haskell code is very expressive and elegant, the language involves a steep learning curve. Concepts like higher-order functions, lazy evaluation and recursion are difficult to teach. Moreover, debugging a functional language is more difficult due to a less intuitive execution model compared to imperative languages.

This thesis presents the implementation of the „Haskell Substitution Stepper“, a tool aiming to address those issues. The goal is to create an environment in which developers can analyze Haskell expressions. To achieve this, the evaluation of those expressions is done step by step, and an explanation for each reduction is given. Such step by step reductions are often printed in textbooks to help understand a small program.

The first step was to research how the Glasgow Haskell Compiler (GHC) transforms and evaluates expressions in the backend. Existing similar solutions were assessed and ideas for improvement were collected. Finally, the „Haskell Substitution Stepper“ was implemented using the intermediate representation „Core“ from GHC.

The result is a command line application. Developers can load a source file with Haskell expressions into the stepper and see the individual reduction steps. The tool can be used for debugging or to better understand specific Haskell expressions. While the stepper is using the Core intermediate representation for the reduction, the result can be pretty printed in a format that looks like regular Haskell code.

Item Type: Thesis (Other)
Subjects: Area of Application > Consumer oriented
Area of Application > Development Tools
Area of Application > Academic and Education
Technologies > Programming Languages
Divisions: Bachelor of Science FHO in Informatik > Bachelor Thesis
Depositing User: OST Deposit User
Thesis advisor
Mehta, Farhad
Date Deposited: 20 Apr 2022 08:50
Last Modified: 20 Apr 2022 08:50
URI: https://eprints.ost.ch/id/eprint/990

Actions (login required)

View Item
View Item