Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Stdlib
On Tue, 2005-11-01 at 13:11 +1300, Jonathan Roewen wrote:

> > All of this can be done (I worked on a system that did it),
> > however it is definitely non-trivial. It is well in advance
> > of anything Haskell can do also.
> Really? 

Really. It is in some sense the Holy Grail of programming
language design. Ocaml doesn't even support higher order
polymorphism -- you cannot pass a polymorphic function to
a function -- when you try it gets monomorphised (yes,
it can be done by wrapping the function in a record or
using classes).

> What about type classes? Haskell has fmap! That's an example
> of what you mean, correct?

Yes, it is an example of what one would like to do,
however it is not the same. You have to provide certain
primitives, and then others are derived from them.

The problem is .. this is nominal typing. In fact, Ocaml
can do this same thing with functors, but the result
is merely a sum of all the named cases -- it isn't

Haskell makes it easier to name the types (monadic notation)
but it isn't any more expressive than Ocaml's functors.
In fact, it is probably the other way around, its just that
instantiating all those dang functors by hand is a pain.
C++ is a breeze by comparison, since templates are instantiated

The point is that the much vaunted 'intensional polymorphism'
in Ocaml only applies to type variables -- there are no
functor variables.

BTW: any real type theorist disgusted with my explanation is
welcome to explain it properly -- in particular why it
is THE central problem of programming theory.

John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: