On Sat, Feb 23, 2008 at 8:00 AM, Harri Kiiskinen <[EMAIL PROTECTED]> wrote: > then why does > > let i = fmap (^4) [1,2,3] in shows i " " > > give > > "[1,16,81] "
I'll probably mess this up somewhere, but if I do, reset assured that someone else here will correct me ;) fmap (^4) [1,2,3] == [1,16,81] so shows " " of that == "[1,16,81] " (note the trailing space), obvious I hope. However, [1,16,81] >>= \i -> shows i " " operates in the list monad. I can't find the actual instance of Monad [] right now, but it will apply 'shows i " "' to each element in the first list and concat the results. Since strings are just [Char], concating them is string concatenation. And so you have "1 16 81 " (again, note the trailing space) AGL -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
