I have the following Haskell program:
catlines = unlines . zipWith (\(n,l) -> show n ++ l) [0..]
main = putStrLn $ catlines ["A", "B"]
When I try to compile it, GHC gives the following error:
catlines.hs:1:41:
Couldn't match expected type `b0 -> String' with actual type `[a0]'
In the expression: show n ++ l
In the first argument of `zipWith', namely
`(\ (n, l) -> show n ++ l)'
In the second argument of `(.)', namely
`zipWith (\ (n, l) -> show n ++ l) [0 .. ]'
From what I know, this should compile. I have no idea what's wrong.
zipWith
? – user824425