I’m trying to concatenate a string given as an argument (using getArgs) to the haskell program, e.g.:
"rm " ++ filename ++ " filename2.txt" which is inside a main = do block.
The problem is with the type of filename, and ghc won’t compile it, giving an error.
I get an error Couldn't match expected type [a] against inferred type IO ExitCode
the code we’re trying to run is:
args <- getArgs
let inputfname = head args
system "rm -f "++ inputfname ++ " functions.txt"
You need
$:Or parentheses:
Otherwise you’re trying to run this:
It fails because
++wants[a](in this caseString) but getsIO ExitCode(fromsystem).