6 ms·
> Condescending tutorials seem to be an integrated part of Haskell culture. Could you perhaps link to one? I know of plenty of misguided tutorials that try to
by tome 7y ago
> Condescending tutorials seem to be an integrated part of Haskell culture.
Could you perhaps link to one? I know of plenty of misguided tutorials that try to be helpful but aren't. I've never come across one I'd call "condescending".
> I can't recollect I have ever learned a programming concept through metaphors. The only way I have learned concepts is though solving tasks in a language and thereby learning to use the tools available.
Yet for some reason newcomers (reputedly) want to know what a monad is before trying to use one! I agree with you: they should go ahead and use one and not worry about what it is!
- pram 7y agoIt's not unique to Haskell, and I wouldn't say condescending. More like patronizing and a little infantile. 'Learn you a Haskell' is in the same tone. Ultimately most of these are just imitations of the 'poignant guide to ruby' which is probably responsible for starting the trend of whimsical and zany programming guides.
- goto11 7y agoYou need to use the IO monad to write "hello world". So it is naturally the first question a newcomer will ask. But for example "Learn you a Haskell" http://learnyouahaskell.com/chapters http://learnyouahaskell.com/chapters postpones "hello world" to chapter 9, after explaining things like type classes. So the reader is expected to read and understand 9 chapters before writing the first program? This is ridiculous - I certainly wouldn't be able to learn anything that way.
- tome 7y agoI'm sorry, I don't understand which part of my comment you were replying to.
- goto11 7y agoYou are suggesting that newcomers to Haskell should not care about what a monad is. I'm pointing out that tutorials like "Learn you a Haskell" are trying to explain monads before even getting to "Hello World".
- tome 7y agoWell then, as you already know I agree with you that this is absurd! > Yet for some reason newcomers (reputedly) want to know what a monad is before trying to use one! I agree with you: they should go ahead and use one and not worry about what it is!
- chrisoverzero 7y ago> [...] trying to explain monads before even getting to "Hello World". Chapter 9: Input and Output Chapter 12: A Fistful of Monads No, that doesn't seem to be the case to me.
- pwm 7y agoSure you need to use the IO monad to write "hello world" but you don't need to understand what it does in the background. #include <stdio.h> int main(int argc, char *argv[]) { printf("Hello World!\n"); return 0; } class HelloWorld { static public void main(String args[]) { System.out.println("Hello World!"); } } main :: IO () main = print "hello world" Hello worlds in C, Java and Haskell. I can write them and run them without needing to fully understand what's behind "*argv[]", "static public void" or "IO ()".
- Elrac 7y agoLet's be fair to Haskell and LyaH: I've taught some Java classes. I can get people writing and running trivially useful code before explaining the concepts of "class" and "static". I explain that parts of the code will remain a mystery for a little while until I explain them, I promise to do so, and of course I fulfill that promise as soon as I can. I feel neither Java nor Haskell are intrinsically bad just because there's no practical way to teach them completely on progressively layered concepts. Even (e.g.) Lisp has a risk of using special forms before understanding them.
- goto11 7y agoSure, but Learn You a Haskell seem to try to avoid saying "I will explain this mumbo jumbo later" by explaining everything up to type classes before getting to "hello world". I guess I should write a Haskell tutorial which starts with "hello world" without trying to teach monads beforehand!
- dllthomas 7y agoSkipping over syntax, I think it's something like: To write any program in Haskell, you define `main`, the IO action that does the work of your program. `putStrLn` is a function that takes a String and returns an IO action that prints the string. So we can write "hello world" simply: main = putStrLn "Hello, World" I'm curious whether you actually think that's more useful than building understanding at the REPL.
- goto11 7y ago> I'm curious whether you actually think that's more useful than building understanding at the REPL. Again, I think this depends on you way of learning. For some people it might be possible to "build understanding" gradually over weeks until you are finally ready to write "hello world" having learnt all the fundamentals of the language. That just doesn't work for me. I need to learn through writing programs which actually does something.
- 7y ago
- chrisoverzero 7y ago> So the reader is expected to read and understand 9 chapters before writing the first program? Not at all. Haskell has a REPL, so anything involving output is defined as pure functions, then executed at the REPL. For example, here's Quicksort: http://learnyouahaskell.com/recursion#quick-sort http://learnyouahaskell.com/recursion#quick-sort That's from Chapter 5. > I certainly wouldn't be able to learn anything that way. Certainly not by only reading the table of contents, sure.
- goto11 7y agoAgain, this is about different ways of learning which ties into what is even the purpose of programming in the first place. For academics, the purpose of a program is to exhibit some clever abstraction. So a quicksort which can't take any input to sort and can't produce any output is a perfectly fine program - almost the platonic ideal of a program. But for developers, the purpose of programs is to do something useful. So learning how to read input and produce output is basically the first thing I want to learn when learning a new language or platform. Because then I can start building small toy programs, gradually doing more and more stuff and learning by tackling the challenges along the way. And implementing quicksort comes way down the line of things I need to learn to write a useful application.
- dllthomas 7y ago> You need to use the IO monad to write "hello world". This isn't actually true. You need to use a value of the `IO ()` type. Your program would still work if `IO` was not an instance of `Monad`. In a similar way, you also need to use a value of type `String` but you don't care that it implements `Read` or `Ord` or `Semigroup`. This doesn't entirely invalidate the rest of what you've written - you do need some basic understanding of how to combine IO actions to do any more interesting IO. But I feel like your presentation is still misleading. "Learn You A Haskell" starts with the REPL, and has you running code in the first tutorial.
- whateveracct 7y agoLYAH is full of programs before chapter 9. It does this by living in ghci. Haskell is different - it makes sense for it to start somewhere else (somewhere more useful!) than hello world.