|
|
|
|
|
by kqr
1666 days ago
|
|
That's not true and never has been. Want to do I/O? main = do
putStrLn "Who are you?"
name <- readLn
putStrLn ("Hello, " ++ name)
There. Do you really need to know something about monads to understand that example? No.Do you need to know how do syntax and the assignment operator <- works? Sure. But that has nothing to do with category theory. That's just syntax. |
|
a. do notation is converted to haskell b. what the bind and return functions do, for IO
So you can figure out;
c. Why your types are not lining up
To understand Haskell in general you need to realise do, bind and return are generic and can be used for not just IO but say for Maybe, List etc.
Basically you need to know most practical things about monads!
I had a bad time writing Haskell do notation until I understood monads. I used to write imperative code, try =, try <-, always undo typing back to known working states etc. to try and magic the code into compiling.