11

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.

josiah
  • 1,314
  • 1
  • 13
  • 33
  • I know little about SML, but I don't think its module system provides dependent types more than Haskell's newer features manage. What Haskellers do in Agda and Idris, the ML family has in Coq. – leftaroundabout Jun 04 '14 at 00:48
  • The way I understand dependent types is that they allow one to write/evaluate type level expressions using values indexing the types at compile time. I am not sure SML modules let you do that, but maybe my understanding of dependent types is too restrictive? – didierc Jun 04 '14 at 00:49
  • 6
    The ML module system does not provide dependent types. I do not understand the rest of the question. Maybe it would be best if you identified the things that you found hard to understand in the documentation you found and ask specific questions about them. – sepp2k Jun 04 '14 at 00:58
  • 1
    I think you might be interested in [that question](http://cs.stackexchange.com/a/9789/4660) on cs.stackexchange.com, and more specifically the answer by Andrej Bauer. – didierc Jun 04 '14 at 01:24
  • 2
    As I understand it, SML's modules are first-class at compile time (they can be passed as parameters, to "functors", which are functions between modules -- different than the haskell use of that word). Haskell has no such mechanism, although it is equivalent in power to typeclasses (though there is a substantial difference in cleanliness depending on what you're trying to do) – luqui Jun 04 '14 at 01:24
  • SML Modules are like classes-objects in functional language. Type-classes are like interfaces-traits in functional language. – viorior Jun 04 '14 at 07:33
  • 1
    This paper might give you an in-depth answer: http://www.cse.unsw.edu.au/~chak/papers/modules-classes.pdf – limp_chimp Jun 05 '14 at 18:11
  • @limp_chimp That paper is exactly what I was looking for. Awesome! – josiah Jun 06 '14 at 19:48

1 Answers1

0

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.)

ruakh
  • 175,680
  • 26
  • 273
  • 307
josiah
  • 1,314
  • 1
  • 13
  • 33
  • 4
    Umm... could you help to provide a brief summary here? The link might be dead and I think only posting a link doesn't really conform to normal SO answer convention. – xji Jun 29 '15 at 10:50
  • I don't think a brief summary is possible. – josiah Jun 29 '15 at 22:17