
27 Dec
2009
27 Dec
'09
9:24 p.m.
On Sun, Dec 27, 2009 at 06:17:34PM +0100, legajid wrote:
Thanks.
for 1, i tried mapM ( putStrLn) (show pref) but show gives only one line with all values, instead of n lines with 1 value. I now understand that show must be in the function that is mapped.
Right, pref is a list so (show pref) will just give you a String representing the entire list. You can do (map show pref) to give you a list of Strings, one for each value. So you could write mapM_ putStrLn (map show pref) which is actually equivalent to mapM_ (putStrLn . show) pref -Brent