scrambling txt file using compiler [closed]

Three things that I can see:

  1. You have the arguments that you pass to scramble in main the wrong way round.

  2. You haven’t defined getContents anywhere.

  3. You’re not using getArgs as you require.

As you guessed, you only need to get the first argument (as getArgs :: IO [String]); using arg1:_ <- getArgs will indeed get you the first argument (assuming there is at least one, otherwise there will be an error). However, you will have that arg1 :: String, and you require an Int, so you need a function of type String -> Int.

This is my understanding based upon how you’ve defined scramble (which seems to be something like a Vigenere cipher), which is completely different from how you defined your initial problem.

Leave a Comment