ML Modules and Haskell Type Classes: A Constructive Comparison

Stefan Wehr

Master's thesis, Albert-Ludwigs-Universität, Freiburg, Germany, November 2005.

Abstract

Researchers repeatedly observed that the module system of ML and the type class mechanism of Haskell are related. So far, this relationship has not been formally investigated. The work at hand fills this gap by presenting a constructive comparison between ML modules and Haskell type classes; that is, it introduces two formal translations from modules to type classes and vice versa, which enable a thorough comparison of the two concepts.

The source language of the first translation is a subset of Standard ML. The target language is Haskell with common extensions and one new feature, which was developed as part of this work. The second translation maps a subset of Haskell 98 to ML with well-established extensions. I prove that the translations preserve type correctness and provide implementations for both.

Building on the insights obtained from the translations, I present a thorough comparison between ML modules and Haskell type classes. Moreover, I evaluate to what extent the techniques used in the translations can be exploited for modular programming in Haskell and for programming with ad-hoc polymorphism in ML.

Bibtex

@MASTERSTHESIS{Wehr2005,
  title = {{ML} Modules and {Haskell} Type Classes: A Constructive Comparison},
  author = {Stefan Wehr},
  year = 2005,
  month = {November},
  school = {Albert-Ludwigs-Universit\"at},
  address = {Freiburg, Germany}
}

Resources

Imprint & privacy policy // Last modified: 2024-09-10T10:21:26+02:00