2 ms·
"They all need to perform IO" - why does a programming language need to perform IO? Haskell does not have a function that performs IO. For instance, `putStrLn
by innguest 12y ago
"They all need to perform IO" - why does a programming language need to perform IO?
Haskell does not have a function that performs IO. For instance, `putStrLn "hello world"` returns an IO action, but it does not print anything to the screen.
In order to "perform IO" you have to name an IO action 'main'. Then the compiler understands that you want that action to take place in the Real World. But Haskell does not know about the Real World and so it cannot do IO.
This difference is important, otherwise there is a misunderstanding that Haskell is just "minimizing IO". It's not - there's no IO.