Archive for the 'Learning' Category

Hard Time Learning Haskell?

July 13, 2011

Last week Ryan asked this excellent question:

For every single other programming language I’ve learned in the past, I was able to make useful, working programs in at most a week after learning about the language. But not for Haskell. Yes I understand what types and type classes are, how to create my own functions and I have a decent grasp of the syntax, but I’m just not sure where to begin. When I want to make something useful, I have to stick everything into a “do” statement and then afterwards I just get stuck and don’t know how to proceed.

How would you guys recommend I solve this problem?

Of course Haskell follows in a radical tradition of establishing platonic functiontional/applicative/declarative core language free of grubby earthly concerns. The machinery provided by the core is then used to build the I/O.

Note that tools like GHC aren’t built in this way but have been planned, constructed and refined with the concerns of real-world applications. But this all takes place within the functional framework established by the core. (A prime motivation for this radical dicipline [if 1980s research grant applications are any guide] was the opportunities it would open up for exploiting massively parallel architectures — see, for example this talk by Simon Peyton Jones).

So most Haskell introductory texts wait until about the penultimate chapter before tackling I/O. But this does not at all jibe with the conventional evolution in learning a programming language where you expect to be writing ‘real programmes’ within a week.

My advice therefore is to kick back, spend some time on (e.g.) the first 17 chapters of Thompson’s book. You should definitely be expecting to spend (at least) the first week interacting with your scripts though the ghci evaluation prompt.

But can Haskell I/O be tackeld in week 2?

Follow

Get every new post delivered to your Inbox.