Good Haskell introduction for an Ocaml programmer?

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. So I was wondering if there was a better introduction for me out there? I'm willing to pay for a book or read something online, whichever. Thanks, Brian

bhurt:
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.
So I was wondering if there was a better introduction for me out there? I'm willing to pay for a book or read something online, whichever.
All good things are findable from http://haskell.org :) We've been working recently on a comparative OCaml/Haskell introductory text, which might be helpful for some beginner issues, syntax, and a few intermediate things like typeclasses: http://haskell.org/haskellwiki/A_brief_introduction_to_Haskell it can be read side-by-side with the Introduction to OCaml, linked on the same page. Otherwise, YAHT is a good start: http://darcs.haskell.org/yaht/yaht.pdf and there's some other good things on: http://haskell.org/haskellwiki/Books_and_tutorials Feel free to drop by #haskell, we've quite a few OCaml refugees there :) -- Don

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.
Okasaki's _Purely Functional Data Structures_ discusses (among other things) the pros and cons of lazily evaluated structures. The examples in the body of the book are in ML and an appendix has "translations" into Haskell.

On 12/12/06, Brian Hurt
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 think that O'Caml programmers would be one audience where I'd start with the "Gentle Introduction" (It's doesn't seem nearly gentle enough to the imperative-minded, but should be fine for someone used to functional programming). http://www.haskell.org/tutorial/ You're likely to find YAHT boring, but I think it may still be a good idea to skim it a bit. Also, you might like reading some specialised tutorials directly. http://haskell.org/haskellwiki/Introduction_to_IO -- a brief 5 minute introduction I wrote about how we think about IO in Haskell. My favourite monad tutorials: http://www.nomaware.com/monads/html/index.html -- This is really thorough and mostly very well written, though there are places where the examples are both highly contrived and hard to comprehend due to excessive use of the continuation monad. http://haskell.org/haskellwiki/Monads_as_containers -- this one I wrote myself, and takes a somewhat different approach to things than most others, treating monads as an abstraction of container types rather than of types of computation. These are just some of my personal recommendations, but there's a lot of stuff that's out there. There are some decent guides to what's available on the wiki: http://haskell.org/haskellwiki/Books_and_tutorials http://haskell.org/haskellwiki/Research_papers -- There's actually quite a lot of introductory material in papers, because writers often can't assume that their audience is intimately familiar with Haskell already, though they may assume a certain level of familiarity with CS in general. Also, make sure you fire up an IRC client and join us at #haskell on irc.freenode.org. There are lots of friendly people there who are always happy to discuss things, answer questions (don't worry if they seem simple), and point you at resources. Welcome to the list and have fun learning Haskell! - Cale

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? http://web.cecs.pdx.edu/~antoy/Courses/TPFLP/lectures/MONADS/Noel/research/m... All About Monads http://www.nomaware.com/monads/html/ 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

Hello Brian, Tuesday, December 12, 2006, 3:39:41 PM, you wrote:
So I was wondering if there was a better introduction for me out there? I'm willing to pay for a book or read something online, whichever.
i think that there are not so much FP programmers learning Haskell (comparing to number of imperative/OOP programmers) so you may be out of luck here. you may just skip things that you already know. laziness, advanced type system, monads and type classes would be main new concepts to learn you will find a lot of introductions into monads in the appropriate section of http://haskell.org/haskellwiki/Books_and_tutorials , including introductions for Muchos, Monsters and even starship builders ;) But the best one is http://sigfpe.blogspot.com/2006/08/you-could-have-invented-monads-and.html you will also find here introduction into monad transformers After you have groked what is monad you can read "all about monads": http://www.nomaware.com/monads/html/index.html you may also be interested in looking at great introduction into Parsec library - parsing combinators is one of non-trivial application of monads: "Parsec, a fast combinator parser" (sorry, i remember only title of this page) you may also find interesting my explanation of IO monad: http://haskell.org/haskellwiki/IO_inside page that describes how type classes works and why they are different to OOP classes: http://haskell.org/haskellwiki/OOP_vs_type_classes also i found interesting to read chapter 7 of GHC users guide which describes all extensions of type system in GHC comparing to Haskell98 standard my another favorite is not about Haskell language but about using it for real-world apps: "Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell" http://research.microsoft.com/Users/simonpj/papers/marktoberdorf/marktoberdo... one more very interesting reading describes main Haskell differences comparing to previous languages: http://research.microsoft.com/~simonpj/tmp/history-v2.pdf -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
participants (6)
-
Brian Hurt
-
Bulat Ziganshin
-
Cale Gibbard
-
dons@cse.unsw.edu.au
-
John Goerzen
-
Seth Gordon