English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Alternative to Haskell type classes?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-12-02 (00:12)
From: Jonathan Roewen <jonathan.roewen@g...>
Subject: [Caml-list] Alternative to Haskell type classes?

I'm just curious about OCaml's stance on Haskell's type classes, and
also whether there are alternative ways of achieving the same thing in

There are some damn useful small things that Haskell's type classes
can do, that I find interesting.

First is Show, like the base method toString in Java, etc. The other
is Enum which lets you convert an enum type to an int, and back again.

I've heard comments on it before for the Num type class, saying how it
hurts performance .. why can't the compiler specialise uses of type
classes so that such overhead is eliminated? They're just overloaded
functions, whose type for each individual invocation is completely
known I believe.