When I try to load the following code to ghci
import System.Environment (getArgs)
import System.IO
interactWith function inputFile outputFile = do
input <- readFile inputFile
writeFile outputFile (function input)
main = mainWith myFunction
where mainWith function = do
args <- getArgs
case args of
[input,output] -> interactWith function input output
_ -> putStrLn "error: exactly two arguments needed"
myFunction = id
it produces error: parse error on input ‘args’. But it is not clear to me what is producing the problem, and I am unable to divine what the problem is by looking at the answers to questions on parse errors.
Why is an error produced?