[Haskell-cafe] Re: Tutorial uploaded

S Koray Can skoraycan at aim.com
Thu Dec 22 02:06:29 EST 2005

Daniel Carrera wrote:
> As a newbie... I agree that a newbie should be able to write this fairly 
> early on:
> main = do
>        x <- getLine()
>        putStrLn ("The answer is " ++ show(fib(read(x))))

I'd agree for some definition of 'early'. I'll elaborate:

This entire discussion is about 'breaking a cyclic graph of conceptual 
dependencies'. Unfortunately, I don't think it can be done well in short 
amount of time.

The above code snippet contains typeclasses (show, read, monadic IO, 
lists), syntactic sugar (do, <-). When you say a 'newbie' should be able 
to write that early on, I'd interpret that as 'a newbie should be able 
to regurgitate this early on' because the next thing a newbie might want 
to do is try to divide the result of fib by a float and wonder why he 
can't do that, or try to debug his fib implementation by trying to 
insert a putStrLn. There are numerous ways to frustration unless the 
newbie is comfortable with typeclasses, monads, etc.

This happens all the time when somebody is learning a new language, but 
it's most problematic for haskell because the breadth of knowledge (of 
various concept of the language) a learner has to gather before he can 
dive deep (formulation, compilation, execution, debugging) into an 
actual (even trivial) program is larger than all popular languages out 

In every language, the most powerful features make their ways into the 
most basic elements (as they should so that the entire language 
benefits, but then, lists are monads?!?!). Learners of C++ with a C 
background are not as much troubled by "cout << yadda << endl;" even 
though there is operator overloading, references and the streams class 
hieararchy in that statement. You can close your eyes and pretend that 
cout is just magic and re-visit that node when you are comfortable with 
classes. I don't think we can break cycles easily like that in Haskell.

The mental load is very high, and with concerns about language features 
vs complexity even in other languages (see 
http://lambda-the-ultimate.org/node/view/1155) I think we are observing 
a new phenomenon: languages worth learning from now on will be 
increasingly difficult (heck, even Perl is difficult now), and we'll 
have to do away with 'tutorials' mostly.

In fact what we have are not really tutorials (YAHT is a small book! 
compare that with http://www.ocaml-tutorial.org/). I think it's a tall 
order for a 'tutorial' to teach Haskell (which may be why we end up 
reading 4-5 of them). In fact Hudak's Haskell book was the first 
introductory language book I'd ever bought. That's why I think tutorials 
can have be frustrating and it takes a well edited book and .


More information about the Haskell-Cafe mailing list