H98 Text IO

David Leuschner david at loisch.de
Wed Feb 27 02:33:58 EST 2008


> Let me try and summarise:

Thanks for the great summary! And thanks to Emacs' table mode here're the
results displayed as a table:

+--------------------------------+-----+--------+------+-------+-------+
|                                | now | locale | utf8 | mix-A | mix-B |
+--------------------------------+-----+--------+------+-------+-------+
| putStrLn "..."                 |  -  |   ok   |  -   |  ok   |  ok   |
+--------------------------------+-----+--------+------+-------+-------+
| ./prog vs ./prog | cat         | ok  |   ok   |  ok  |  -    |  ok   |
+--------------------------------+-----+--------+------+-------+-------+
| ./prog in vs ./prog < in       |  -  |   ok   |  -   |  ok   |  -    |
+--------------------------------+-----+--------+------+-------+-------+
| ./prog vs ./prog | hexdump -C  | ok  |   ok   |  ok  |  -    |  ok   |
+--------------------------------+-----+--------+------+-------+-------+


The mixtures are good ideas but can give inconsistent and suriprising
results (especially when debugging encoding issues).  And if our CEO would
have known that ... putStrLn <his-name> ...  doesn't work he'd have
probably ruled out Haskell right from the start.  Even "utf8" gives
surprising results: I'd be very surprised if my Mac-written Haskell
program outputs junk on Windows or Linux even if the byte sequence is
exactly the same UTF-8 text.

Personally I think consistency on a single platform is more important than
trying to achieve cross-platform consistency which involves a lot more
than just encoding.  If you've reached that point with your program you're
probably anyway using "advanced functions" to exactly specify what will be
output.  Following "the principle of least surprise" is also a good idea.

Cheers,

   David


-- 
David Leuschner
Meisenweg 7
79211 Denzlingen
Tel. 07666/912466
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/libraries/attachments/20080227/d6be80e9/attachment.bin


More information about the Libraries mailing list