
14 Feb
2007
14 Feb
'07
6:36 a.m.
Hi Eeek, a solution that does monadic maps and require's rank 2 types! arr = [('a',1), ('b',2), ('c',3)] showAll = lines (map showItem arr) showItem (a,n) = a : " = " ++ show n main = putStr showAll I've broken this up a bit more than usual - most people would probably just put showAll inside main, but this separates out the concepts. arr is the data, which you could construct with a zip if that really is all there is to it. showItem shows a single item, showAll shows them all, and main just prints out the information. And this solution is Haskell 98, anything that uses printf is Haskell' only. Thanks Neil