With this code:
main :: FilePath -> FilePath -> IO ()
main wrPath rdPath = do x <- readFile rdPath
writeFile wrPath x
As in C, Java, or C#, main
is a special identifier in certain contexts that indicates where the program should start.
In Haskell, main
is defined to have the type IO a
. You should either give your function a different name, or if you really want it to be the starting point, change its signature and have it read the arguments from the command line with getArgs
Although you didn't ask it specifically, main
is also special in that it is the only function in a Haskell program that can (safely) invoke IO actions. The Haskell runtime treats main
as special.