With this code:
main :: FilePath -> FilePath -> IO ()
main wrPath rdPath = do x <- readFile rdPath
writeFile wrPath x
Because the language spec says so.
A Haskell program is a collection of modules, one of which, by convention, must be called
Mainand must export the valuemain. The value of the program is the value of the identifiermainin moduleMain, which must be a computation of typeIO tfor some typet(see Chapter 7). When the program is executed, the computationmainis performed, and its result (of typet) is discarded.