News for hackers. Stuff that matters.
Re:OCaml Modules: Think Immutable Singletons by lindig on Sunday May 24, 2015 @04:12PM (#9597398)
OCaml modules and Haskell type classes are quite separate, too. I would make more sense to compare OCaml and Haskell modules. Haskell type classes implement ad-hoc polymorphism and OCaml doesn't have that at all. You can't implement in OCaml something like a show function that works on integers and strings and list of integers and so on like in Haskell using the Show type class.
Re:OCaml Modules: Think Immutable Singletons by namanbharadwaj on Sunday May 24, 2015 @04:49PM (#9597521)
In fact, OCaml modules do correspond to Haskell type class instances, and there are ways to extend the ML module system to support ad-hoc style polymorphism (http://www.mpi-sws.org/~dreyer/papers/mtc/main-long.pdf).

On the other hand, you can also use modules as a simple namespacing mechanism (as in Haskell modules). But this does not capture the full power of the module system.

Re:OCaml Modules: Think Immutable Singletons by DonPellegrino on Sunday May 24, 2015 @04:16PM (#9597418)
You sort of can with functors or GADTs.
Re:OCaml Modules: Think Immutable Singletons by lindig on Sunday May 24, 2015 @04:24PM (#9597447)
Like you say, sort of. This would imply that you wrap all the basic types in a sum type. It's quite heavy. Using the PPX mechanism the compiler can also be extended to generate this code automatically but again, this isn't very natural at the moment.