How does forever monad work?
forever :: (Monad m) => m a -> m b
forever a = a >> forever a
If I write
main =
The distinction to make is that putStrLn "SAD, I DON'T UNDERSTAND!" is an action, not just a value. It repeatedly executes that action. Whenever something of type IO a is evaluated, it executes its internal actions and then returns something of type a wrapped in the IO context. It doesn't have to take a parameter for the action to do something. For example, look at the getCurrentTime function from the time package. It just has type IO UTCTime, but if you call it several times you'll get different values back, even though it takes no parameters.