5 ms·
Ah. You found Haskell hard because you were trying to learn it out of order. Demanding to understand what a monad is before learning how higher-order functions
by chowells 3y ago
Ah. You found Haskell hard because you were trying to learn it out of order. Demanding to understand what a monad is before learning how higher-order functions and higher-kinded polymorphism work in Haskell is like demanding to know what an Iterator is before learning what a variable is in Java.
The thing about "Monad" is that it's an absolutely trivial interface. You'll know you actually understand it properly when you go "oh, that's all." Is it hard to describe? Not when you understand the underlying concepts. But if you demand to skip them, you're only going to confuse yourself.
- appleaday1 3y agohttps://bartoszmilewski.com/2021/02/16/functorio/ https://bartoszmilewski.com/2021/02/16/functorio/
- 7thaccount 3y agoNo, but a good assumption. I read several books and dozens of tutorials including parts of the 1000 page one that couple did like 6 years ago. Function application and so on definitely came before IO and the likes. It all just seemed like enormous mental effort for the simplest of things. That was my experience at least. It's possible I just don't have the best kind of brain for FP. Your mileage will vary of course. This was just my experience. I know Haskell is powerful, but it wasn't right for me. I haven't met a scripting language I didn't like yet though, so perhaps my neurons are just wired for that now. I do enjoy the random APL or Forth problem though and I'm decent at SQL after using it often for a decade.
- Tainnor 3y ago> parts of the 1000 page one that couple did like 6 years ago. IMHO that book is bloated and overrated. Maybe it works for some people, but I find the explanations really weird and some of the exercises are just useless busywork without a point. There are good parts in there (they do try to teach you how to properly think about types which is nice) but I really feel like you don't need to read 1000 pages to learn basic Haskell.
- 7thaccount 3y agoFine. I also read Learn You a Haskell, the O'Reilly one and a myriad of other sources. In comparison, Python was a cake walk.
- Tainnor 3y agoOh I agree that Haskell is complicated to learn, I just happen to think that that book kinda makes it even worse.
- lmm 3y agoWhich makes it rather unfortunate that Haskell is a language where the recommended way of writing a program to e.g. read two numbers from the user, add them, and print the result, demands understanding "Monad".
- tome 3y agoWhere do I have to 'understand "Monad"' to write this? main = do x <- readLn y <- readLn print (x + y) Do I have to 'understand "Monad"' to write this? def main(): x = input() y = input() print(x + y)
- lmm 3y ago> Where do I have to 'understand "Monad"' to write this? The recommended explanation of what <- is/does will be about "Monad".
- tome 3y agoYou're moving the goalposts! You said 'the recommended way of writing a program to e.g. read two numbers from the user, add them, and print the result, demands understanding "Monad".'
- Tainnor 3y agoI don't think it's "moving the goalposts" when you demand that you can understand, at least to a first-order approximation, what the code that you write is doing. Yes, you could just treat IO as a black box and memorize a bunch of weird syntax rules, but you're going to have a hard time very quickly, especially when you change something and the compiler throws errors at you. FWIW, I think that monads are a powerful abstraction, but they're certainly not incredibly natural and Haskell basically just throws them at you from day 1.
- lmm 3y agoThe recommended way of writing a program in most languages demands some level of understanding what you're writing. You would have to somehow come up with the "<-" parts of that program, and the recommended way of doing that is to understand Monad.