Am Sonntag, 9. Dezember 2007 23:35 schrieb Ketil Malde:
> Daniel Fischer <[EMAIL PROTECTED]> writes:
> >>> IO is important because you can't write any real program without using
> >>> it.
> >>
> >> Ouch! I get awfully discouraged when I read statements like this
> >> one.
> >
> > I think Lennart was referring to that, you HAVE to know a little IO to
> > write programmes, at least getArgs, getLine, putStr(Ln), readFile,
> > writeFile, appendFile. And therefore some use of the IO monad has to be
> > taught relatively early.
Emphasis on *use*, introduce the concept of monads not before lists, Maybe and
Either.
>
> Well, I guess you could get pretty far using 'interact' - far enough
> in an educational setting to do lists and Maybe, and then monads,
> before introducing monadic IO.
>
> -k
Pretty far, yes, and in an educational setting, at a university, it is quite
common, I believe, to use an interpreter for a while, not producing
executables (that's how I met Haskell, write pure functions and type
expressions at the Hugs prompt). But what about a tutorial for programmers?
How would you do
main = do
putStrLn "Please enter your name."
name <- getLine
putStrLn $ "Hello " ++ name ++ ", nice to meet you."
in that setting?
I doubt you could keep many interested without telling them how to create
standalone programmes, including reading input from stdin and printing output
to stdout.
Cheers,
Daniel
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe