
10 May
2011
10 May
'11
1:15 p.m.
On 10/05/2011 08:30 AM, Yitzchak Gale wrote:
I think the clearest way to write it is:
f = putStrLn . (++ " - message received") . show . Main.id
You're serious??
If I were to describe to someone in words what this function does, I would say something like: "Apply Main.id, turn it into a string, tack a message onto the end, and print it." So why not write it that way in Haskell?
Hmm, I suppose. OTOH, this breaks if you want to insert several items into a string. For example, f x y z = putStrLn ("X = " ++ show x ++ ", Y = " ++ show y ++ ", Z = " ++ show z) (Fortunately, here a simple call to ($) will fix you up nicely.)