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"
I like that
unwords (ls1 ++ [unwords ls2]) == unwords (ls1 ++ ls2)
but not that 'unlines'
Here is a concern:
At present, a final \n in lines' input is optional, because a line is
ended by either a \n or the end of the string. Consequently lines "a"
and lines "a\n" have the same value ( ["a"] ). This seems a desirable
feature that is worth preserving.
Consider the composition
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;
|