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=1.8 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 2F087BB84 for ; Thu, 14 Aug 2008 15:28:45 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Am8BAMzPo0jRVZK3lGdsb2JhbACRPz4BAQEBCQMKBxEDnQ+GcQECgxw X-IronPort-AV: E=Sophos;i="4.32,210,1217800800"; d="scan'208";a="16116325" Received: from wa-out-1112.google.com ([209.85.146.183]) by mail1-smtp-roc.national.inria.fr with ESMTP; 14 Aug 2008 15:28:44 +0200 Received: by wa-out-1112.google.com with SMTP id j4so229590wah.3 for ; Thu, 14 Aug 2008 06:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:reply-to:to:subject:date :user-agent:cc:references:in-reply-to:content-type :content-transfer-encoding:content-disposition:message-id; bh=AE8ujmaxcT0GtOi9FjYsE6zYb0cAB5kjPDXP+Voyr3Y=; b=nncG9t6vYo0u9wfvHmUStzRIjVlOtvvZEY/HbBPBOOlesxiDbKdOnk4Iu+gCA+miXs 7LTu8OIXN7ooCFlY7IajJCmQGmaL3cpkp4y8beM2/6EAmwr9aaIciZyy4UWIuY+gpBtf sSUFo6Sbj7A0Gu4FXzuu98H87PPGNo0uX375M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:cc:references:in-reply-to :content-type:content-transfer-encoding:content-disposition :message-id; b=gltBX+od40+kSJfntI8lBtJ1eaf39d4qSdoc1VmFZUAsBNRmNoKSSJtvJaJpcAj5kg h6aZuFbAYAXUxmj4jt6VaZgudakaqB8jBt1DQN4nXB5IOUD+vgVNDeeZCxfUw9uHA2i3 PuP4WTWgzS9UQ1UEpZCfzB9Jg1PxPN3oNhn+Y= Received: by 10.114.73.1 with SMTP id v1mr1105139waa.16.1218720522859; Thu, 14 Aug 2008 06:28:42 -0700 (PDT) Received: from lawn-143-215-204-204.lawn.gatech.edu ( [143.215.204.204]) by mx.google.com with ESMTPS id 5sm730000yxt.1.2008.08.14.06.28.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 14 Aug 2008 06:28:42 -0700 (PDT) From: Peng Zang Reply-To: peng.zang@gmail.com To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Haskell vs OCaml Date: Thu, 14 Aug 2008 09:28:34 -0400 User-Agent: KMail/1.9.7 Cc: "blue storm" , "circ ular" References: <527cf6bc0808140450w3182b14n60764d3862b9080f@mail.gmail.com> In-Reply-To: <527cf6bc0808140450w3182b14n60764d3862b9080f@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808140928.40626.peng.zang@gmail.com> X-Spam: no; 0.00; haskell:01 ocaml:01 hash:01 ocaml:01 haskell:01 sig:01 syntax:01 functors:01 sig:01 monads:01 real-world:01 peng:98 peng:98 storm:98 wrote:01 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 14 August 2008 07:50:43 am blue storm wrote: > 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. I would restate the last as: OCaml has an object system, Haskell has type classes. In Haskell you can write a function that takes anything that is "showable" (a type class) and print it out. The sig would be something like (I'm mixing OCaml and Haskell syntax here, but hopefully the point is still clear): Showable 'a => 'a -> unit You can't quite do that with modules/functors. However with objects you can write a function that takes a showable and executes it. It's sig would look like this: showable -> unit where class type showable = object method print : unit -> unit ... end As to Haskell vs. OCaml, they are both great languages. Haskell is more researchy and experimental (although with Haskell Prime they are making a big push to make it more friendly to industrial uses). This is great because you get some really cool stuff. This is also bad because all the cool stuff is hard to understand and sometimes you-just-want-to-get-stuff-done. OCaml is great for that and for one other thing that I think few people point out. OCaml supports a variety of programming styles: OO, imperative and functional. This means it's easy for anyone to pick up and use. If you have collaborators, OCaml projects have an easier learning curve. Anyone can feel more or less at home using OCaml in a week. In contrast, Haskell has quite a steep initial learning curve (eg. you need to learn monads before you can write any interesting real-world application) which can be a big barrier to potential collaborators. Also the ability to switch styles often lets you write faster. For some problems, I just think in one style versus another. It just comes more easily to me in a functional style sometimes, and an OO style other times. OCaml let's you write however you think about it. Haskell makes you think about it in *the haskell* way. Sometimes this is good because it forces you to do certain things. Othertimes it just gets in your way. Peng -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQFIpDMIfIRcEFL/JewRAtN1AKCth4Iep/uNUaFObIcyvAQXS0LmwgCdHQB2 wP8iIzC8YUtOlxmuPPfSKqU= =g/dJ -----END PGP SIGNATURE-----