Hi Sigbjorn,

| Here's a Prelude inconsistency that's been irking me once 
| in a while for a loong time - today it came up again, so here goes:
| 
|   unlines   ["a","b"]   ==> "a\nb\n"
|   unwords ["a","b"]   ==> "a b"
|
| [... unwords adds space between items, not at the beginning or end;
| unlines puts a newline after each item, including at the end ...]

I quite like the fact that the definition for unlines gives us laws
like:

  unlines (xs ++ ys) = unlines xs ++ unlines ys
  unlines . concat   = concat . map unlines

Of course, the fact that unwords doesn't add a terminating space
means that we don't get quite such nice laws for unwords ...

All the best,
Mark


Reply via email to