when i try to compile listing below
import System.Environment(getArgs)
import System.Exit
import Control.Monad(when)
main = do
args <- getArgs
when (length args /= 2) $ do
putStrLn "Syntax: passwd-al filename uid"
existFailure
the compiler complaints : The function 'putStrLn' is applied to two arguments. but obviously it takes only one String and existFailure is just another IO action from System.Exit.
how to fix this?
I get no such error with putStrLn - it's fine in the code you posted (notice spacing might be different, SO doesn't reproduce tabs and instead only displays indents via spaces, which matters for Haskell).
However, you have existFailure, which I think is really cool but you are probably meaning to use the function exitFailure. Notice the difference between exist and exit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With