Sebastian Sylvan wrote:
Well, I certainly disagree there.
I'm not advocating going into a full-blown explanation of monads, just
enough to actually be able to write a real stand-alone program after
the first chapter. They only need to know that do-notation is for
sequencing computations, and (<-) is for binding a name to the result
of a computation. That's it!
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))))
Now, you just said "do-notation is for sequencing computations". Would
it be fair to say that do-blocks are imperative blocks in an otherwise
functional program?
You could spend the next ten chapters with coding examples that are
not very IO-heavy, and lead with a good example of doing as much as
possible in the pure world (as well as pointing out every now and then
whenever a particularly good "IO-separtion" was achieved - to
emphasize that it's good practice).
When someone who has programmed before learns Haskell and gets the
impression that IO is beeing left for later because it's "hard" they
might think "bah, what a rubbish language, IO in Visual Basic isn't
hard at all!".
I would agree with both paragraphs. Show basic IO and show that there's
no need for complex IO because all the logic should be functional.
Cheers,
Daniel.
--
/\/`) http://oooauthors.org
/\/_/ http://opendocumentfellowship.org
/\/_/
\/_/ I am not over-weight, I am under-tall.
/
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe