Scroll past the Haskell example for a moment and look at the Python. The program p2 is the same as p1, except a refactoring is performed: the call to readFile(file) is DRY'd into a variable, and this changes the meaning of the program.
In the Haskell example, the same refactoring is performed. Because IO actions are treated as values in their own right, the refactoring does not change the meaning of the program. Executing p1 or p2 will have the same effect.