How can I convert [(char,Int)]
to a String of the Int in the second component gives the number of repetitions of the character in the first component? For examp
The facetious and horrible answer:
Prelude> let replignore ((_,x):[]) = [replicate x 'b']; replignore ((_,x):xs) = replicate x 'a' : replignore xs
Prelude> replignore [(a,9),(b,10)]
:1:13: Not in scope: `a'
:1:19: Not in scope: `b'
Prelude> let a = undefined
Prelude> let b = undefined
Prelude> replignore [(a,9),(b,10)]
["aaaaaaaaa","bbbbbbbbbb"]
But it didn't quite fit the specs since it includes the quotation marks in the answer. ;)
My point is, you need quotes around your Char
and String
literals.