-- Takes a number on the command line and write the factorial of that -- number to a file called num.txt import System main = do x<-getArgs writeFile "num.txt" (show(fac(rInteger(x !! 0)))) fac :: Integer -> Integer fac n = product [1..n] rInteger :: String -> Integer rInteger = read