Search code examples
haskellmodulesmltype-systems

What is the difference in capability between the SML module system and Haskell's Type and Typeclass system?


I'm trying to understand where the shortcoming is here. Does the SML Module system merely provide dependent types, similar to how Idris has extended the Haskell type system, or is there more going on than just the addition capability of dependent types? Information on the SML Module system in existing internet articles has either been hard to find or hard to understand for me.

** Edit ** There was some confusion about what I'm really getting at with this question, and the confusion seems to stem from my confusion about the ML Module system (I think due to the fact that I understood Functors in the Haskell way). Dependent types was offered as an example of what could be different between the 2 type systems, but it turns out to have been a bad example since neither system supports such a thing (at least not directly).

The main goal of this question is for me to determine the differences in expression of concepts between the ML and Haskell type systems. Which abstractions/concepts cannot be represented in one that can be in another? Why would someone claim that ML's typesystem is more modern/powerful than Haskell's, or vice versa. Another way to think of this is where is one type system lacking where the other is not?

The reason I'm interested in knowing this is due to my interest in architecting software systems and how different type systems make modularity and extensibility of the software easier or more difficult. I've been unimpressed with Object Oriented type systems from imperative languages, so I'm now branching out and studying those offered by ML and Haskell as they are the first ones that interested me.


Solution

  • The POPL 2007 paper "Modular Type Classes", by Derek Dreyer, Robert Harper, and Manuel M.T. Chakravarty, gives a pretty detailed comparison between the Haskell and ML type systems, with examples. Unfortunately, I don't think a brief summary is possible; but the entire paper is available online at https://www.cs.cmu.edu/~rwh/papers/mtc/short.pdf. (Hat-tip to limp_chimp's comment above.)