caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jonathan Roewen <jonathan.roewen@gmail.com>
To: caml-list@yquem.inria.fr
Subject: [Caml-list] Alternative to Haskell type classes?
Date: Fri, 2 Dec 2005 13:12:07 +1300	[thread overview]
Message-ID: <ad8cfe7e0512011612t75a06ee9m933a2d8bd7d282c@mail.gmail.com> (raw)

Hi,

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
OCaml.

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.

Jonathan


                 reply	other threads:[~2005-12-02  0:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad8cfe7e0512011612t75a06ee9m933a2d8bd7d282c@mail.gmail.com \
    --to=jonathan.roewen@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).