[Haskell-cafe] Re: Tutorial uploaded

2005-12-27 Thread John Goerzen
On 2005-12-20, Daniel Carrera [EMAIL PROTECTED] wrote: Hi all, I've finished a first draft of what I call First steps in Haskell. It's intended to be the very first thing a new user sees when they decide to try out Haskell. I should point out a parallel effort that a few of us have worked

Re[2]: [Haskell-cafe] Re: Tutorial uploaded

2005-12-23 Thread Bulat Ziganshin
Hello Daniel, Wednesday, December 21, 2005, 6:34:10 PM, you wrote: DC You can show them this on the first page: DC main = do DC x - getLine() DC print my_program(x) this named `interactive` :) try: main = interactive(map toUpper) -- Best regards, Bulat

Re[2]: [Haskell-cafe] Re: Tutorial uploaded

2005-12-23 Thread Bulat Ziganshin
Hello Bill, Wednesday, December 21, 2005, 6:38:33 PM, you wrote: BW PS: While looking over my post it occurred to me that the issue is at BW least as much methodological as it is linguistic. So I ask: Does BW Haskell stand far enough apart from other programming languages to BW warrant

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-23 Thread Bulat Ziganshin
Hello Daniel, Thursday, December 22, 2005, 3:13:06 PM, you wrote: DC Well, I'm a newbie, and I wrote it. I have enough understanding to DC generate that code, even if I don't understand it all. This is what I know: please, don't learn Haskell!!! we will test different tutorials on you! :)))

Re[2]: [Haskell-cafe] Re: Tutorial uploaded

2005-12-23 Thread Bulat Ziganshin
Hello John, Thursday, December 22, 2005, 3:48:37 AM, you wrote: JM You can't not start with IO for people who already know how to program, JM if you are teaching someone programming for the very first time then JM starting with the pure functional side is fine. But for people that JM already

[Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Daniel Carrera
S Koray Can 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: [snip] The above code snippet contains

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Sebastian Sylvan
On 12/22/05, Daniel Carrera [EMAIL PROTECTED] wrote: S Koray Can 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

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Paul Moore
On 12/22/05, John Meacham [EMAIL PROTECTED] wrote: Just the idea that you can write things like mapM and replicateM is enough to blow the mind of many impertive programmers. Not trying to fan the flames, but one thing I struggle with is understanding (at a gut level - if you explain the theory,

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Donn Cave
On Thu, 22 Dec 2005, Paul Moore wrote: ... FWIW, I don't really see why the -M functions are needed either. It's something to do with the fact that map is for lists, and mapM is for monads, which are a more general type of sequence than a list. But why mapM isn't therefore a superset of map,

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread John Meacham
On Thu, Dec 22, 2005 at 02:02:56PM +, Daniel Carrera wrote: I had never heard of mapM, or other -M functions. I can't imagine why those would be needed. It seems like pointless duplication. (!!!) then you are missing out. the M functions (and monadic traversal functions in general)

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Sebastian Sylvan
On 12/22/05, Daniel Carrera [EMAIL PROTECTED] wrote: Paul Moore wrote: As I say, I'm not trying to criticize anyone here, but it seems to be quite hard to get across to people who have understood and assimilated this sort of stuff, just how hard it feels to newcomers. We understand the

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Jared Updike
SKC This entire discussion is about 'breaking a cyclic graph of conceptual SKC dependencies'. Unfortunately, I don't think it can be done well in short SKC amount of time. I bet if we sat down and listed all the concepts required to write idiomatic Haskell (even idiomatic Haskell 98 (whatever

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-22 Thread Udo Stenzel
Paul Moore wrote: Not trying to fan the flames, but one thing I struggle with is understanding (at a gut level - if you explain the theory, I'll understand, but go away none the wiser in practice...) why I need mapM as well as map (and all the other -M functions, liftM, foldM, etc...) All you

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Ketil Malde
Neil Mitchell [EMAIL PROTECTED] writes: I would have actually said Hugs, and especially the Windows front end WinHugs was a lot more suitable for beginners than GHC, but the wiki page very much gives the other impression. Which page are you referring to? I went to look, but couldn't find any

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Creighton Hogg
On Wed, 21 Dec 2005, Robin Green wrote: Henning Thielemann wrote: Starting with IO in Haskell is like starting LaTeX with rotating text and making it colorful. Not at all! Indeed IO _is_ complicated regardless of whether it is modelled by Monads in Haskell or differently in other

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Daniel Carrera
Robin Green wrote: Whilst localising IO to a small part of the program is generally a good idea, beginners should not be scared off by the thought that IO in Haskell is so hard it has to be covered on page 94. This is not the case. It should be introduced on page 1. As a newbie... I'll agree

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Udo Stenzel
Robin Green wrote: If people want Haskell to be treated as a practical language, not just something for doing academic teaching and research with, it should be taught as a practical language - which means that things like IO and space/time usage come to the forefront. Strange, I always

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Henning Thielemann
On Wed, 21 Dec 2005, Robin Green wrote: Henning Thielemann wrote: Starting with IO in Haskell is like starting LaTeX with rotating text and making it colorful. Not at all! Indeed IO _is_ complicated regardless of whether it is modelled by Monads in Haskell or differently in other

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Henning Thielemann
On Wed, 21 Dec 2005, Creighton Hogg wrote: I agree with this wholeheartedly. When I first started playing with Haskell, some of the tutorials made it look like it was very difficult to do anything practical with it because doing real input and output seemed like an advanced topic. The

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Daniel Carrera
Udo Stenzel wrote: Strange, I always thought predictable, understandable and above all correct code would be the primary goal, with small and quick code coming later. Depends on what you mean by quick and small. Do you mean that the program should execute fast and have a small memmory

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Daniel Carrera
Henning Thielemann wrote: IO is always complicated: I have never once thought it was complicated. All I've ever needed are print() and readLine() and those shouldn't be complicated IMO. And I wouldn't want to wait for page 120 to learn how to do that. My programs are not going to be useful

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Creighton Hogg
On Wed, 21 Dec 2005, Henning Thielemann wrote: On Wed, 21 Dec 2005, Creighton Hogg wrote: I agree with this wholeheartedly. When I first started playing with Haskell, some of the tutorials made it look like it was very difficult to do anything practical with it because doing real

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Cale Gibbard
On 21/12/05, Daniel Carrera [EMAIL PROTECTED] wrote: Henning Thielemann wrote: IO is always complicated: I have never once thought it was complicated. All I've ever needed are print() and readLine() and those shouldn't be complicated IMO. And I wouldn't want to wait for page 120 to learn

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread John Hughes
-- Message: 1 Date: Wed, 21 Dec 2005 10:48:08 + From: Robin Green [EMAIL PROTECTED] Subject: Re: [Haskell-cafe] Re: Tutorial uploaded Beginners should start with non-monadic functions in order to later avoid IO

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Henning Thielemann
On Wed, 21 Dec 2005, Creighton Hogg wrote: On Wed, 21 Dec 2005, Henning Thielemann wrote: The drawback is that I saw many Haskell programs implemented with IO read/write functions which could be easily implemented without IO, using laziness. Can you think of any examples of things like

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Wolfgang Jeltsch
Am Dienstag, 20. Dezember 2005 20:07 schrieb Sebastian Sylvan: [...] It's sometimes beneficial to lie a bit when starting out. Perhaps say something like this is a simplified view of things, for all the gory details see chapter 19. Monadic IO is pretty darn cool, sadly that means that many

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Wolfgang Jeltsch
Am Mittwoch, 21. Dezember 2005 11:48 schrieb Robin Green: [...] If people want Haskell to be treated as a practical language, not just something for doing academic teaching and research with, it should be taught as a practical language - which means that things like IO and space/time usage

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Udo Stenzel
Daniel Carrera wrote: Depends on what you mean by quick and small. Do you mean that the program should execute fast and have a small memmory foot-print? I was referring to Robin's mentioning space/time usage, so yes, that's what I meant. To write interactive Haskell code well, you have to

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Udo Stenzel
Creighton Hogg wrote: On Wed, 21 Dec 2005, Henning Thielemann wrote: The drawback is that I saw many Haskell programs implemented with IO read/write functions which could be easily implemented without IO, using laziness. Can you think of any examples of things like that? Given that

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Udo Stenzel
Robin Green wrote: I meant that for *many* but not all practical programming tasks, IO is important. ...web applications... Ha, wrong! A CGI script only needs getEnv, getContents and putStr, if it has persistent state, it also needs readFile and writeFile. Each of the five is called exactly

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Daniel Fischer
Am Mittwoch, 21. Dezember 2005 13:31 schrieb Daniel Carrera: Udo Stenzel wrote: Strange, I always thought predictable, understandable and above all correct code would be the primary goal, with small and quick code coming later. Depends on what you mean by quick and small. Do you mean that

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Daniel Carrera
Udo Stenzel wrote: Unless you want to teach people to program as they would do in Basic, that is. I don't know what you mean by that. You will soon. Once you get used to composing functions instead of sequencing actions, you'll appreciate the difference. Ah. Yes, I do think I understand

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Sebastian Sylvan
On 12/21/05, John Hughes [EMAIL PROTECTED] wrote: -- Message: 1 Date: Wed, 21 Dec 2005 10:48:08 + From: Robin Green [EMAIL PROTECTED] Subject: Re: [Haskell-cafe] Re: Tutorial uploaded Beginners should

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Daniel Carrera
Daniel Fischer wrote: P.S.: In May, there was a 'Daniel Carrera' around, too. Isn't that a strange coincidence? That was myself, using a different email address. I didn't get too far with Haskell that time, but I remembered that I liked it, so I'm going back to it a bit now. But I'm still a

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Sebastian Sylvan
On 12/21/05, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: Am Dienstag, 20. Dezember 2005 20:07 schrieb Sebastian Sylvan: [...] It's sometimes beneficial to lie a bit when starting out. Perhaps say something like this is a simplified view of things, for all the gory details see chapter 19.

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Sebastian Sylvan
On 12/21/05, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: Am Mittwoch, 21. Dezember 2005 11:48 schrieb Robin Green: [...] If people want Haskell to be treated as a practical language, not just something for doing academic teaching and research with, it should be taught as a practical

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Daniel Carrera
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 (-)

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Daniel Carrera
Sebastian Sylvan wrote: Beginners know that too. In fact, they often think that practical applications need far more IO than they really do! So to insinuate even slightly that Haskell is bad at IO by avoiding it for two thirds of a book, is really going to inforce the idea that Haskell isn't a

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Bill Wood
On Wed, 2005-12-21 at 13:10 +0100, Udo Stenzel wrote: . . . tutorial. Before that, IO should be restricted to the EVA principle (Eingabe, Verarbeitung, Ausgabe == Input, Processing, Output). It was a good principle in the 60s, and it still is. Unless you want to teach people to program

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Sebastian Sylvan
On 12/21/05, Daniel Carrera [EMAIL PROTECTED] wrote: Sebastian Sylvan wrote: Beginners know that too. In fact, they often think that practical applications need far more IO than they really do! So to insinuate even slightly that Haskell is bad at IO by avoiding it for two thirds of a

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Wolfgang Jeltsch
Am Mittwoch, 21. Dezember 2005 16:30 schrieb Daniel Carrera: [...] Would it be fair to say that do-blocks are imperative blocks in an otherwise functional program? Not really. do expressions are (normally) equivalent to expressions containing applications of (=) and/or (). If the monad you

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Donn Cave
On Wed, 21 Dec 2005, Udo Stenzel wrote: [... re pitfalls of IO for the beginner ] Here's another one: I've heard a fellow claim, Haskell is basically unsuitable to implement a compiler, because Haskell is weak at IO and everything needs IO, the lexer, the preprocessor, the parser, the

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Udo Stenzel
Donn Cave wrote: Meanwhile, that fellow evidently didn't write any compiler in Haskell at all. Better a C++ program than a Haskell program that offends you? Oh no, he actually wrote something disgusting built mostly out of regexes in Perl. I don't think it even works, and I don't think I

[Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Peter Simons
Some example for writing a text the IO oriented way: do putStrLn bla replicateM 5 (putStrLn blub) putStrLn end whereas the lazy way is putStr (unlines ([bla] ++ replicate 5 blub ++ [end])) Um, maybe it's just me, but I think the first program is far superior to the

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Tomasz Zielonka
On Wed, Dec 21, 2005 at 07:35:28PM +0100, Peter Simons wrote: Some example for writing a text the IO oriented way: do putStrLn bla replicateM 5 (putStrLn blub) putStrLn end whereas the lazy way is putStr (unlines ([bla] ++ replicate 5 blub ++ [end])) Um, maybe

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Philippa Cowderoy
On Wed, 21 Dec 2005, Peter Simons wrote: Some example for writing a text the IO oriented way: do putStrLn bla replicateM 5 (putStrLn blub) putStrLn end whereas the lazy way is putStr (unlines ([bla] ++ replicate 5 blub ++ [end])) Um, maybe it's just me, but I

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Benjamin Franksen
On Wednesday 21 December 2005 18:48, Udo Stenzel wrote: Donn Cave wrote: Meanwhile, that fellow evidently didn't write any compiler in Haskell at all. Better a C++ program than a Haskell program that offends you? Oh no, he actually wrote something disgusting built mostly out of regexes

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Tomasz Zielonka
On Wed, Dec 21, 2005 at 09:30:14PM +, Philippa Cowderoy wrote: On Wed, 21 Dec 2005, Tomasz Zielonka wrote: I don't know how it's done, but when you compile it with 'ghc -O2', the program runs in constant space. Unfortunately with Hugs and GHCi it grows. The live set, or just the

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Cale Gibbard
On 21/12/05, Tomasz Zielonka [EMAIL PROTECTED] wrote: On Wed, Dec 21, 2005 at 07:13:07PM +, Philippa Cowderoy wrote: Try running putStrLn (unlines (repeat hello!)) You may be surprised ;-) Or not ;-) But yes, I should've checked and my comments on how that'll behave

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Benjamin Franksen
On Wednesday 21 December 2005 12:17, Daniel Carrera wrote: Robin Green wrote: Whilst localising IO to a small part of the program is generally a good idea, beginners should not be scared off by the thought that IO in Haskell is so hard it has to be covered on page 94. This is not the

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Hal Daume III
As a newbie... I'll agree with Robin. I /did/ think that IO in Haskell was probably very difficult because it's covered in page 94. I skimmed through YAHT and IO is covered wyyy deep into the document. I haven't read that section yet, but there is a lot of content and to me it looked

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread John Meacham
noise The truth is, Haskell friggen rocks at IO compared to imperative languages. We are all spoiled and see IO in haskell as ugly because we have been exposed to the pure functional goodness of the rest of haskell. but teaching haskell as a better impertive language than imperative ones from the

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Benjamin Franksen
On Wednesday 21 December 2005 16:49, Sebastian Sylvan wrote: On 12/21/05, Daniel Carrera [EMAIL PROTECTED] wrote: Sebastian Sylvan wrote: Beginners know that too. In fact, they often think that practical applications need far more IO than they really do! So to insinuate even slightly

[Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread S Koray Can
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

[Haskell-cafe] Re: Tutorial uploaded

2005-12-20 Thread Peter Simons
== So how do I write Hello, world? == Well, the first thing you need to understand that in a functional language like Haskell, this is a harder question than it seems. Most of the code you will write in Haskell is purely functional, which means that it returns the same thing every

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-20 Thread Sebastian Sylvan
On 20 Dec 2005 19:52:31 +0100, Peter Simons [EMAIL PROTECTED] wrote: == So how do I write Hello, world? == Well, the first thing you need to understand that in a functional language like Haskell, this is a harder question than it seems. Most of the code you will write in Haskell

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-20 Thread Daniel Carrera
Peter Simons wrote: In my humble opinion, it's unfortunate that many tutorials and introductionary texts leave the impression that monadic code would be something utterly different than normal Haskell code. I feel it intimidates the reader by making a monad appear like black magic, even though

[Haskell-cafe] Re: Tutorial uploaded

2005-12-20 Thread Peter Simons
Daniel Carrera writes: I'm scared of monads :) I really don't know what a monad is. Neither do I, but that doesn't mean that I can't use just fine. ;-) putStrLn :: String - World - World That seems less scary. Things become a lot clearer when you think about how to print _two_ lines

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-20 Thread Bill Wood
On Tue, 2005-12-20 at 20:07 +0100, Sebastian Sylvan wrote: . . . I'm still looking for a good *practical* tutorial that I could recommend to newcomers. IO, data types and QuickCheck in the very first chapter, I say! Real program examples from the get go, and go into the theory on why this

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-20 Thread Neil Mitchell
Hi, Hugs Interpreter onlySuitable for learning. You'll need GHC for serious work. This is putting Hugs down quite a bit. I personally prefer Hugs, and use it for serious work (including developing a Haskell compiler, and 4 years of academic study and counting). About the only thing

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-20 Thread Benjamin Franksen
On Tuesday 20 December 2005 20:58, Peter Simons wrote: Daniel Carrera writes: I'm scared of monads :) I really don't know what a monad is. Neither do I, but that doesn't mean that I can't use just fine. ;-) putStrLn :: String - World - World That seems less scary. Things

Re[2]: [Haskell-cafe] Re: Tutorial uploaded

2005-12-20 Thread Bulat Ziganshin
Hello Neil, Tuesday, December 20, 2005, 11:52:51 PM, you wrote: NM Hi, Hugs Interpreter onlySuitable for learning. You'll need GHC for serious work. NM This is putting Hugs down quite a bit. I personally prefer Hugs, and NM use it for serious work (including developing a Haskell