Version française
Home     About     Download     Resources     Contact us    
Browse thread
Typeclasses in OCaml (Was: Haskell vs OCaml)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Hurt <bhurt@s...>
Subject: Re: [Caml-list] Typeclasses in OCaml (Was: Haskell vs OCaml)


On Thu, 14 Aug 2008, Jim Farrand wrote:

> 2008/8/14 Peng Zang <peng.zang@gmail.com>:
>
> Out of curiosity, are there any theoretical reasons why OCaml could
> not be extended with type classes?  They are one of my favourite
> features of Haskell, and I think they would really improve OCaml.

Because everything you can do with type classes you can do with monads and 
functors, and vice-versa.  If you're thinking "hey, this would be a real 
nice function to have type classes for", try functorizing it.  Use the 
features the language already has, instead of wishing for new ones.

Some things are clunky to do in functors, I agree, but the same can be 
said of type classes- and I'm far from convinced that type classes are 
innately a better idea than functors.

Brian