My error message is as follows: ‘ Couldn’t match expected type ‘[a0]’ with actual type ‘([char], [Int])’ In the first argument of ‘zip’
I’m trying to do run length encoding, e.g
My code is this:
encode  =  encode ls = zip((map head list), (map length list)) where list = runs ls
The ‘runs’ function returns [String], e.g
I don’t know how to fix it, any help or explanation would be appreciated!
You are trying to use C-style syntax to call
zip, which is interpreted as
zip getting a single tuple as its argument, rather than the two lists you intended.
encode ls = zip (map head list) (map length list) where list = runs ls
Answered By – chepner
Answer Checked By – Timothy Miller (BugsFixing Admin)