
Real World Haskell - tsally
http://book.realworldhaskell.org/read/
======
lallysingh
Just finished the book last night.. Some thoughts:

1\. It covers the core language pretty well.

2\. It covers the secondary aspects even better. Including: Linking to C,
performance analysis, parallelization, and a touch of compiler internals.

3\. Written in a very readable tone, but assumes it's not your first time
around the functional block. I picked up the pragmatic erlang book after this,
and was put away at how much "baby's first functional language" it was in
comparison.

4\. Lots of examples in different areas: GTK, databases, networking, binary
I/O. Grounds the reader coming from C/C++/Java land pretty well back in how to
use the functional stuff for real work. Also shows that you can get all those
tasks done with a good functional style, without mind bending.

~~~
mitchellh
I agree with your points. However I know many programmers who don't enjoy this
step-by-step nonsense it gives and would rather just have the language
definition and a few short examples (not a complete JSON parser or binary file
parser for instance).

So I would say: Want a book that'll have you learn Haskell fairly well and
give you giant examples, but takes a week to read (or more)? Read RWH.

If you want to learn the basic language, w/o much example fluff, and learn the
language in 2 days, read YAHT (linked in a comment below by me).

~~~
DenisM
And if you have serious problems focusing (like I do) I recommend
<http://learnyouahaskell.com/> It was very easy to read.

~~~
erso
LYAH was what got me really going with Haskell. Highly recommended.

------
davidw
So what is the sweet spot of Haskell in the Real World? What is its
comparative advantage over other languages? Where is using Haskell, and not C,
Erlang, Java, Forth, Cobol, Ruby or Lisp going to be a big win?

~~~
rkts
Haskell has two useful features that are missing from the languages you
mentioned:

1\. Strong static typing

2\. Pattern matching

(1) tends to make development go faster (in my experience) by catching your
mistakes early and locating them more accurately than a debugger can. It's
also good for performance.

(2) is great for any program that does a lot of stuff with trees, such as a
compiler.

However, neither of these features is unique to Haskell. They're also present
in OCaml, SML, F#, and Scala, all of which should be easier to learn and start
using than Haskell.

The main qualities that distinguish Haskell from other languages are purity
and laziness. These may be worth learning about since they're theoretically
interesting, but their practical value is pretty dubious.

~~~
dons
> purity and laziness. These may be worth learning about since they're
> theoretically interesting, but their practical value is pretty dubious

Purity is important if you care about safety, maintainability, or paralellism.
Also makes transactional memory tractable.

~~~
rkts
You keep saying that, but I've never heard a justification for it that wasn't
totally Kool-Aid flavored.

I'm all for safety in the sense of catching errors at compile time, _provided_
they can be caught with minimal help from the programmer. Proof of more
complicated properties should be optional. Haskell requires you to embed a
proof of functional purity into every program you write, and this is just not
how programming should work.

As to maintainability, this claim is clearly false. Pure programs become
harder to change as they grow, because adding and removing side effects
requires drastic restructuring.

Of course, most Haskell programs (in my limited observation) seem to deal with
problems that are mostly mathematical or computational in nature, like
compilers and Sudoku solvers, where these issues don't arise much. But that's
not really an endorsement for something that purports to be useful in the Real
World.

~~~
dons
I'm not sure where this idea that it is "mostly used for sudoku solvers" comes
from. While clearly insulting, it is also clearly false.

The breadth of code on <http://hackage.haskell.org/> gives witness to this,
with just on 1000 libraries written over the last 18 months, most heavily
weighted towards networking, graphics, guis, databases, and so on.

Similarly, the industrial users ,
<http://haskell.org/haskellwiki/Haskell_in_industry> , aren't writing sudoku
solvers, but are finance houses, defense contractors, game companies,
bioinformatics places, hardware dessign, a full range of applications, for a
general purpose language.

~~~
rkts
Sorry, I didn't mean to imply that Haskell is only used for writing toy
programs. I meant that Haskell people gravitate toward problems that are
functional in nature. Many such programs are useful, though rarely in
isolation.

If you're wondering where the idea comes from, here's an example. There is a
thread on Facebook titled "What have you made using Haskell?"

[http://www.facebook.com/topic.php?uid=2213713570&topic=2...](http://www.facebook.com/topic.php?uid=2213713570&topic=2811)

Here are the responses:

1\. HAppS (a web thingy)

2\. A minesweeper clone

3\. A preprocessor for POV-Ray source files

4\. A program to prove graph isomorphisms

5\. A parser for boolean logic sentences

6\. A lambda expression evaluator with alpha equivalence testing

7\. A hyperbolic raytracer

8\. An image regression program

9\. A program that finds equidistant letter sequences

10\. A boolean expression to truth table converter

11\. A resolution theorem prover

12\. An interpreter of a Prolog basic subset

13\. A Markov Chain generator

14\. An anagram generator

15\. A library for doing computation inside various algebraic structures

16\. A maze generator and solver

Some of these are exercises, some are toys, some look potentially useful. But
except for the first two, they are all pure-functional problems, and are
rather abstract. Maybe this sample isn't representative of all Haskell usage
or what Haskell is capable of, but the stereotype, like most stereotypes,
exists for a reason.

~~~
dons
I wouldn't imagine facebook is a representative sample of the serious
developer community...

------
mitchellh
I prefer "Yet Another Haskell Tutorial" to jump into the language quicker.

<http://www.cs.utah.edu/~hal/docs/daume02yaht.pdf>

Its much more technical but for programmers with experience in functional
languages, its much quicker to jump in than "Real World Haskell"

------
socratees
This is a really cool initiative. And I see users have already started
commenting on sections of the book pointing out the corrections. Way faster
than normal ways of type proofing. I have just started to read the book - will
do it over the weekend.

------
GHFigs
This is the true story of seven functions picked to live in a program, and...I
don't know enough about Haskell to make a decent joke.

(What I _do_ know is that that is a very simple and beautiful site with a
clever commenting system and selections from one of the most incredible icon
sets ever made.)

~~~
jrockway
Huh?

~~~
jcl
He's referring to the opening to MTV's "The Real World".

<http://en.wikipedia.org/wiki/The_Real_World#History>

------
andreyf
Once you have basics down, it's worthwhile to go through and understand these:

[http://www.zvon.org/other/haskell/Outputlist/introduction.ht...](http://www.zvon.org/other/haskell/Outputlist/introduction.html)

------
xenoterracide
awesome, I didn't realize there was a free version online. Thanks for the
link.

------
antidaily
The only language named after a 50's TV brown-noser.

~~~
silentbicycle
It's named in honor of Haskell Curry, the mathematician.

~~~
antidaily
Ahh, thanks.

