[Haskell-cafe] First steps in Haskell

Daniel Carrera daniel.carrera at zmsl.com
Sun Dec 18 12:02:36 EST 2005

Chris Kuklewicz wrote:
> Almost everything is explained under
> http://www.haskell.org/ghc/docs/6.4.1/html/users_guide/ghci.html

Ok. How would a visitor to the Haskell site find this document? If this 
is the correct document for a beginner to start with Haskell, perhaps 
the site should be updated to point to it instead of the documents it 
currently points to.

I find some usability problems in the documentation section. Think of 
usability in terms of barriers. If you have low barriers, a lot of 
people will have enough motivation to cross them and get started with 
Haskell. If the barriers are very high, only the most intent and 
motivated users will get started. Barriers are bad.

Consider some barriers for a user who wants to learn Haskell:

* There's no way for a new user to figure out how to successfully run 
the simplest Haskell program.
* The first tutorial listed requires the user to give up some personal 
information before getting the tutorial.

These are very significant barriers.

Sure, it's not all bad. For example, Haskell has a friendly community 
(low barrier). But the barriers that exist are a problem because they 
hit the person who is trying to take the very very first step. If you 
can make that *fist* step easier, more people will take it.

> The main things is: The ghci prompt accepts either command, starting
> with a color such as :load "filename" or haskell IO code, since it
> is in a do-block. Thus let is required.

I understand that the design of Haskell might force this behaviour (I 
don't know, but I guess it must). The best solution I can think of (from 
a usability POV) is to provide a very brief tutorial, just 1/2 page, 
just enough to get someone through "hello world", and put it right at 
the top of the Learning Haskell section. I would remove the Intro 
section (it would fit better on the front page) and replace it with a 
1/2 page tutorial. Something like this:

-------------// Sugestion -------------

(You must have <link>Hugs or GHC installed</link>)

1. Open a text editor and type:
fac :: Integer -> Integer
fac 0 = 1
fac n | n > 0 = n * fac (n-1)

2. Save as "fac.hs"
3. On a terminal:

$ ghci
Prelude> :load fac.hs
Compiling Main             ( fac.hs, interpreted )
Ok, modules loaded: Main.
*Main> fac 12

4. Press Ctrl+D to exit.

For more information, look at the following tutorials:
-------------// Sugestion -------------

There. That's brief, and it's enough to get the user past the first 
step. It sends the message that Haskell is not so scary.

> More typically you would write your code in a file, as shown in:
> http://www.haskell.org/ghc/docs/6.4.1/html/users_guide/ch03s02.html


      /\/`) http://oooauthors.org
     /\/_/  http://opendocumentfellowship.org
    \/_/    I am not over-weight, I am under-tall.

More information about the Haskell-Cafe mailing list