[Haskell-cafe] Re: Good Haskell introduction for an Ocaml programmer?

John Goerzen jgoerzen at complete.org
Tue Dec 12 23:51:58 EST 2006

On Tue, 12 Dec 2006 07:39:41 -0500, Brian Hurt wrote:

> Greetings, all.  I'm an experienced Ocaml programmer, looking to broaden 
> my horizons yet further and pick up Haskell, and I'm wondering if there's 
> a good introduction to Haskell for me.  I have Simon Thompson's "Haskell: 
> The Craft of Functional Programming", which isn't a bad book, but I'm 
> something of a special case.  I'm already familiar with and comfortable 
> with a lot of concepts which are new to your average C++/Java programmer- 
> things like symbolic computation and recursion as looping and applicative 
> data structures.  So churning through introductions to these concepts 
> looking for the rare nugget of new information is, well, kinda boring.  On 
> the other hand there are a lot of Haskell concepts I'm not comfortable 
> with, like monads.

I made a similar transition.  You'll find the type system to be quite
familiar in some areas.  Though Haskell has typeclasses instead of the OO
extensions that OCaml does.

For something online, a reasonable place to start is Yet Another Haskell
Tutorial, though it suffers from the same problem of a number of tutorials
in that it leaves IO as an afterthought.

You might also try:

  What the hell are Monads?


  All About Monads


But I think you are probably going to just have to put up with a bit of
review.  Yes, things like recursion and anonymous functions and parts of
the type system will be familiar.  But other things, such as IO, the rest
of the type system, and especially laziness, will not be.

Overall, though, I think you will be pleasantly surprised with Haskell.  I
think of Haskell as the language that both OCaml and Python ought to be. 
Compared to Haskell, OCaml's I/O system is a mess (with the standard
I/O system not even able to open a file in read/write mode), it has two
separate and incompatible list-like types (a list and a stream), and the
object system is poorly integrated into the language.  That's not to say
that Haskell is perfect, but it feels like OCaml++ to me.

(In the sense of "the natural evolution of OCaml", not "OCaml bastardized
by design by committee" as some would argue C++ is.)

-- John

More information about the Haskell-Cafe mailing list