caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Peng Zang <peng.zang@gmail.com>
To: caml-list@yquem.inria.fr
Cc: "blue storm" <bluestorm.dylc@gmail.com>,
	"circ ular" <circularfunc@gmail.com>
Subject: Re: [Caml-list] Haskell vs OCaml
Date: Thu, 14 Aug 2008 09:28:34 -0400	[thread overview]
Message-ID: <200808140928.40626.peng.zang@gmail.com> (raw)
In-Reply-To: <527cf6bc0808140450w3182b14n60764d3862b9080f@mail.gmail.com>

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


  parent reply	other threads:[~2008-08-14 13:28 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-13 12:48 circ ular
2008-08-13 13:27 ` [Caml-list] " Brian Hurt
2008-08-14  0:09 ` Jon Harrop
2008-08-14  2:46   ` David Thomas
2008-08-14  2:52     ` Erik de Castro Lopo
2008-08-14 10:37       ` Paolo Donadeo
2008-08-14 12:17     ` Jon Harrop
2008-08-14 16:44       ` Erik de Castro Lopo
2008-08-14 11:50 ` blue storm
2008-08-14 12:47   ` David Mitchell
2008-08-14 13:28   ` Peng Zang [this message]
2008-08-14 14:01     ` Peng Zang
2008-08-15  2:09       ` blue storm
2008-08-14 13:57   ` Jon Harrop
2008-08-14 14:06     ` Peng Zang
2008-08-14 14:21     ` Vincent Hanquez
2008-08-14 14:44       ` Jon Harrop
2008-08-14 20:57     ` Nicolas Pouillard
2008-08-14 21:16       ` Jon Harrop
2008-08-14 21:50         ` Nicolas Pouillard
2008-08-15  0:15           ` Jon Harrop
2008-08-15  1:14             ` Stéphane Glondu
2008-08-17  1:00             ` Luca Saiu
2008-08-19  2:40             ` Paul Snively
2008-08-20 11:33 ` Dr. Thomas Fischbacher
2008-08-21  8:47   ` DooMeeR
2008-08-21 10:59     ` David Teller
2008-08-21 13:52     ` Dr. Thomas Fischbacher
2008-08-14 13:26 Damien Guichard
     [not found] <fa.e3jKyg6bl9+vTkPgypQ4ZRzEoos@ifi.uio.no>
2013-03-18  9:08 ` adrian.alexander.may
2013-03-18  9:48   ` Malcolm Matalka
2013-03-18  9:59     ` Gabriel Scherer
2013-03-18 11:05       ` Adrian May
2013-03-18 11:26     ` Kakadu
2013-03-19  1:23       ` Francois Berenger
2013-03-26 10:36         ` Nicolas Braud-Santoni
2013-03-26  0:49   ` Kristopher Micinski
2013-03-26  2:37     ` Erik de Castro Lopo
2013-03-26  2:57       ` Kristopher Micinski

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=200808140928.40626.peng.zang@gmail.com \
    --to=peng.zang@gmail.com \
    --cc=bluestorm.dylc@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=circularfunc@gmail.com \
    /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).