Why can't Haskell be tricked into performing IO operations by using strict evaluation?
问题 I'm just learning Haskell and IO monads. I'm wondering why wouldn't this force the program to output "hi" as well as "bye": second a b = b main = print ((second $! ((print "hi") >>= (\r -> return ()))) "bye") As far as I understand, the $! operator would force the first argument of second to be evaluated, and the >>= operator would need to run print "hi" in order to get a value off of it and pass it to \r -> return () , which would print "hi" to the screen. What's wrong with my reasoning? And