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
ambitious proposal: polymorphic arithmetics
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-04-06 (15:51)
From: Sébastien Hinderer <Sebastien.Hinderer@e...>
Subject: Re: [Caml-list] ambitious proposal: polymorphic arithmetics

> So here it goes: why don't we have polymorphic +, -, etc. while we
> have polymorphic =, <, etc.?  Many novices and (at least) some experts
> feel that +., -., etc. are not quite nice.  Why not define +, -,
> etc. for as many types as possible such as integers, floating-point
> numbers, and tuples?  I think they can be implemented almost in the
> same efficient way as =.  They can also raise an exception if applied
> to unsupported values such as functions, just as = does.

By the way, why isn't it possible to detect this kind of errors at
compile-time ?
Isn't the type-system strong enough ?

> P.S. I believe I'm not proposing anything as serious as Haskell type
> classes.

I was wondering if it would be theoretically possible to have
Haskell-like type classes in Caml ?
If it is possible in theory, is it something Caml developers plan to
implement, one day ?