From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.1 required=5.0 tests=AWL,DNS_FROM_RFC_POST, HTML_00_10,HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id B5CBCBB84 for ; Thu, 14 Aug 2008 13:50:44 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Am8BAMi4o0hA6ba7lGdsb2JhbACCYY5ePgEBAQEJAwoHEQOcfoZ/AQI X-IronPort-AV: E=Sophos;i="4.32,209,1217800800"; d="scan'208";a="13989347" Received: from nf-out-0910.google.com ([64.233.182.187]) by mail2-smtp-roc.national.inria.fr with ESMTP; 14 Aug 2008 13:50:44 +0200 Received: by nf-out-0910.google.com with SMTP id b11so275200nfh.13 for ; Thu, 14 Aug 2008 04:50:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=LG+FhV84gjiSjO3dB611jZwA+ZGpwLMzwoouJruZDEY=; b=lzrp0BbjpasM1eh5813pQV7viHWqHclOUV6T93L8o+V/wZLQ+lkCIAoNjcG2LsAKeZ Zpj323y8rCqJwpTTWHWPJ6lH7DmF/ynyHCWhGOkxUvFE6NH4vCjSKNn2KiESYQq+zIvq rarwb7W2BYvWzYDQH9IzIjwXsmBygoBvZhMSk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=OH6yF7mbnyDWdQV0ccnu+MMExY/jc1c/5b0seTSddjRsDzn5JldM1qbuP2b46a4zlV vNGrtuXt5PqxEmYMd9N1KYg+Mxl7kAN5YeFUnTd5crILoJ6S/QvyiHDSaniYfRBEYhaC Tg7/pNB7yVNa7sk1KZzb8OvVJe482p3UvE294= Received: by 10.210.76.19 with SMTP id y19mr1254329eba.186.1218714643996; Thu, 14 Aug 2008 04:50:43 -0700 (PDT) Received: by 10.210.72.8 with HTTP; Thu, 14 Aug 2008 04:50:43 -0700 (PDT) Message-ID: <527cf6bc0808140450w3182b14n60764d3862b9080f@mail.gmail.com> Date: Thu, 14 Aug 2008 13:50:43 +0200 From: "blue storm" To: "circ ular" Subject: Re: [Caml-list] Haskell vs OCaml Cc: caml-list@yquem.inria.fr In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_78133_13369742.1218714643995" References: X-Spam: no; 0.00; haskell:01 ocaml:01 haskell:01 ocaml:01 non-trivial:01 vastly:01 syntax:01 syntax:01 semantics:01 higher-level:01 higher-order:01 combinators:01 stdlib:01 stdlib:01 variants:01 ------=_Part_78133_13369742.1218714643995 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline So it seems the debate went on anyway. I had written something, but when just before posting i saw Brian Hurt's post, and decided not to. It now seems i was wrong, and actually (when reading the others) my post seems quite balanced after all. I'm not saying that the other posters are biased in any way. But i have the point of view of someone trying to learn a language "for fun" and in order to discover interesting features or novel point of views. It seems Haskell do much better in that context that in the "use it to do something useful in the cruel world" context used so far. So here is my original post : I'm afraid your question is a bit too general (and it seems strange to ask that on the mailing-list of one of the projects, while asking for a balanced answer). The main differences are : OCaml is impure (imperative features in the language), Haskell is pure. OCaml is strict, Haskell is lazy. Ocaml has modules, Haskell has type classes. If you're coming from the imperative land, OCaml is, in my opinion, easier to learn. It is also a good choice to begin with OCaml because everything you learn with the OCaml basics can be reused for learning Haskell (the converse is also true, but then you have to learn lazy evaluation first, wich is a non-trivial shift, and is vastly less used in OCaml). Haskell is certainly worth the effort, but my personal opinion is that learning OCaml first is a good idea. Moreover, for "real world" application, you may prefer OCaml over Haskell. The syntax are different, but not so much (before learning haskell, i could generally understand the purpose of tiny haskell sources). I have heard some people say they prefer the Haskell syntax, but this is more a matter of taste (and not very relevant if you want to learn something from the language semantics). Both have their ugly sides. Idiomatic OCaml implementations tend to produce more efficient than Idiomatic Haskell implementations (but Haskell compilers are getting better and better everyday (for Haskell performances to be good, compilers have to do lots of clever and not so simple optimizations), and Haskell is faster than most (scripting) languages used these days anyway). The Haskell standard library is bigger than the Ocaml one, but this is probably not an advantage for beginners (because this means more time spent in browsing the doc, while playing with the language and reimplementing functions yourself is much more interesting). Haskell program thus tends to be more terse and "higher-level" (because of reusing a lot of higher-order combinators in the stdlib): OCaml is also very expressive, but the simplicity of the stdlib tends to keep people on simpler things. To the advanced programmer, both languages have interesting advanced features to offer. Haskell tends to specialize in sophisticated type system features, whereas OCaml has an interesting object system, and polymorphic variants. Both languages have very interesting derivatives, specific languages intended to explore a specific area (concurrency, metaprogramming, etc...). Camlp4 is a flexible and powerful Ocaml preprocessor. Haskell has some tools in that direction, that i have never used (so i'm mostly guessing here), but they seem to be even less supported and used inside the community. ------=_Part_78133_13369742.1218714643995 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
So it seems the debate went on anyway. I had written something, but when just before posting i saw Brian Hurt's post, and decided not to. It now seems i was wrong, and actually (when reading the others) my post seems quite balanced after all.

I'm not saying that the other posters are biased in any way. But i have the point of view of someone trying to learn a language "for fun" and in order to discover interesting features or novel point of views. It seems Haskell do much better in that context that in the "use it to do something useful in the cruel world" context used so far.

So here is my original post :

I'm afraid your question is a bit too general (and it seems strange to ask that on the mailing-list of one of the projects, while asking for a balanced answer).

The main differences are :
OCaml is impure (imperative features in the language), Haskell is pure.
OCaml is strict, Haskell is lazy.
Ocaml has modules, Haskell has type classes.

If you're coming from the imperative land, OCaml is, in my opinion, easier to learn.
It is also a good choice to begin with OCaml because everything you learn with the OCaml basics can be reused for learning Haskell (the converse is also true, but then you have to learn lazy evaluation first, wich is a non-trivial shift, and is vastly less used in OCaml).
Haskell is certainly worth the effort, but my personal opinion is that learning OCaml first is a good idea. Moreover, for "real world" application, you may prefer OCaml over Haskell.

The syntax are different, but not so much (before learning haskell, i could generally understand the purpose of tiny haskell sources). I have heard some people say they prefer the Haskell syntax, but this is more a matter of taste (and not very relevant if you want to learn something from the language semantics). Both have their ugly sides.

Idiomatic OCaml implementations tend to produce more efficient than Idiomatic Haskell implementations (but Haskell compilers are getting better and better everyday (for Haskell performances to be good, compilers have to do lots of clever and not so simple optimizations), and Haskell is faster than most (scripting) languages used these days anyway).

The Haskell standard library is bigger than the Ocaml one, but this is probably not an advantage for beginners (because this means more time spent in browsing the doc, while playing with the language and reimplementing functions yourself is much more interesting). Haskell program thus tends to be more terse and "higher-level" (because of reusing a lot of higher-order combinators in the stdlib): OCaml is also very expressive, but the simplicity of the stdlib tends to keep people on simpler things.

To the advanced programmer, both languages have interesting advanced features to offer. Haskell tends to specialize in sophisticated type system features, whereas OCaml has an interesting object system, and polymorphic variants. Both languages have very interesting derivatives, specific languages intended to explore a specific area (concurrency, metaprogramming, etc...).

Camlp4 is a flexible and powerful Ocaml preprocessor. Haskell has some tools in that direction, that i have never used (so i'm mostly guessing here), but they seem to be even less supported and used inside the community.
------=_Part_78133_13369742.1218714643995--