What is wrong with the following code? I just wanted to connvert an input intoin the following format in a listfile: n - count of test cases // n numbers integersn1 n2 (read via stdin) into list of strings.integers and display it?
socks :: Int -> Int
socks x = x + 1
strToInt = read :: String -> Int
strLToIntL :: [String] -> [Int]
strLToIntL xs = map (strToInt) xs
main = do
n <- readLn :: IO Int
mapM_ putStrLn $ map show $ strLToIntL $ fmap (take n . lines) getContents
I am getting the compile error when i run it:
Couldn't match expected type `Char' with actual type `[Char]'
Expected type: String -> [Char]
Actual type: String -> [String]
In the second argument of `(.)', namely `lines'
In the first argument of `fmap', namely `(take n . lines)'