this line of code in Haskell produces an error on compilation:
lineStat :: String -> [String]
lineStat xs = zipWith (\n line -> show n ++ " " ++ show $ length line) [1..] $ lines xs
Error:
Couldn't match expected type Int -> String with actual type [Char]
The first argument of ($) takes one argument,but its type [Char] has none
However this line of code works:
lineStat xs = zipWith (\n line -> show n ++ " " ++ show (length line)) [1..] $ lines xs
Why?