Newbie: understanding main and IO()

Posted by user1640285 on Stack Overflow See other posts from Stack Overflow or by user1640285
Published on 2012-09-01T09:36:27Z Indexed on 2012/09/01 9:37 UTC
Read the original article Hit count: 147

Filed under:

While learning Haskell I am wondering when an IO action will be performed. In several places I found descriptions like this:

"What’s special about I/O actions is that if they fall into the main function, they are performed."

But in the following example, 'greet' never returns and therefore nothing should be printed.

import Control.Monad

main = greet

greet = forever $ putStrLn "Hello World!"

Or maybe I should ask: what does it mean to "fall into the main function"?

© Stack Overflow or respective owner

Related posts about haskell