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.)

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to