Haskell's Overlooked Object System
Wouldn’t it be nice if Haskell had OCaml-like language extensions that permitted imperative object-oriented programming?
Actually, according to Kiselyov and Laemmel, language extensions aren’t necessary, and they proceed to lay out OOHaskell, a Haskell library for imperative, Object-Oriented programming which is significantly more powerful than OCaml’s built-in facilities.
The present paper settles the question that hitherto has been open. The conventional OO idioms in their full generality are expressible in current Haskell without any new extensions. It turns out, Haskell 98 plus multi-parameter type classes with functional dependencies are sufficient…
...The fact that we found a quite unexpected (and unintended) use of the existing Haskell features is reminiscent of the accidental discovery of C++ template meta-programming. The latter is no longer considered an exotic accident or a type hack—rather, a real feature of the language…
(Thankfully it’s nowhere near as ugly as template metaprogramming in C++...)
Now we just need a very tiny bit of syntax sugar (vis a vis that provided for Monads), and a Haskell implementation that’s as fast and portable as OCaml’s…