H98 Text IO
simonmarhaskell at gmail.com
Tue Feb 26 10:26:02 EST 2008
Roman Leshchinskiy wrote:
> Duncan Coutts wrote:
>> On Wed, 2008-02-27 at 00:31 +1100, Roman Leshchinskiy wrote:
>>> Also, would this affect the encoding used for file names? If so, how?
>> No, that's a separate issue.
> Hmm, so how do I reliably read a list of file names from a file?
You didn't say what format the file takes, so there are a couple of
options. If you get to choose the format, then using read/show is easiest.
If you're stuck with a predefined format, say one filename per line, then
it depends what system you're on:
- on Windows, filenames are Unicode, so the file must be in
some encoding: decode it appropriately.
- on Unix, filenames are binary, so use openBinaryFile and hGetLine.
Yes, this is all broken (in particular FilePath == [Char] is wrong), but at
least it's possible to do what you want, and it's not getting any worse
with the proposed change. Filenames are something else that need an
overhaul, but one thing at a time.
More information about the Glasgow-haskell-users