Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Haskell vs OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-08-14 (13:56)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Haskell vs OCaml
On Thursday 14 August 2008 12:50:43 blue storm wrote:
> 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).

Monads and zippers?

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

That reminds me: you can run the same OCaml code in the top-level, in the 
bytecode interpreter and through the native code compiler.

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

Even if Haskell's performance is improved it will remain unpredictable and, 
consequently, it will continue to be impossible to optimize non-trivial 
Haskell programs.

> and Haskell is faster than most (scripting) languages used these days
> anyway). 

Despite being written in Python, Mercurial is orders of magnitude faster than 

> The Haskell standard library is bigger than the Ocaml one,

Does the Haskell stdlib provide a database interface, md5 checksums, 
marshalling, pretty printing, lexer generator, graphics library, regular 
expressions, unix interface and weak references?

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

I'm not sure what you mean by "simplicity of the [OCaml] stdlib tends to keep 
people on simpler things" but there is certainly far more non-trivial 
software written in OCaml than Haskell, both open source and commercial.

> Camlp4 is a flexible and powerful Ocaml preprocessor...

And an extensible general-purpose parser generator that is higher-level than 
Parsec. Camlp4 rocks!

Dr Jon D Harrop, Flying Frog Consultancy Ltd.