'Why does Haskell need to have IO/Actions even though it's lazy-evaluation?

I suppose this may be a controversial topic because I touch the language design deeply, and I know some one around won't like that because they misunderstand I deny some virtue of what they like.

Why does Haskell need to have IO/Actions even though it's lazy-evaluation?

I understand the value of IO/Actions mechanism to hold so-called "purity" of functional programming if it's for an eager-evaluating language such as C, JavaScript or any others.

In fact, I did emulate/implement IO () in Typescript that evaluates eagerly, then I thought "Ok, cool, but why does Haskell need this??"

Haskell is lazy in default, therefore even the function is defined as

print == console.log

in JavaScript syntax, in Haskell since it's lazy, print won't be executed in anyway unless it's connected to main :: IO ().

Any thoughts?

Edit:

Apparently, this question arises from total misconception of mine.

In Haskell, it defined as

print == console.log

print :: Show a => a -> IO () -- Defined in ‘System.IO’

I simply misunderstood as if defined as

print :: Show a => a -> _ -> IO ()

because it's needed to be so to emulate in eager evaluation.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source