ML Modules and Haskell Type Classes: A Constructive Comparison

Stefan Wehr

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


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.


  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}


Imprint & privacy policy // Last modified: 2023-11-27T14:23:35+01:00