> I don't agree with this. Certainly for the example given, it is possible
> to code the required problem in Haskell, as Junxian J Liu indicated in
> the original posting:
Of course Haskell is adequate in some sense. Just like Turing machines
are. I always take these questions as regarding how convenient it
is to write programs; in a theoretical sense almost all languages
are equivalent.
> I would be very worried if you could write it in Haskell. An
> implementation of standard Haskell I/O should preserve referential
> transparency, but can you still guarantee this if you also include
> something like openFile?
The only thing you have to do to guarantee referential transparency is
to remember the contents of all files that have been openFile:ed and
give the same value back on the next openFile of the same file.
Combining openFile and write causes no problems with r.t. whatsoever
if you just guarantee that openFile behaves as I described.
You may not always get the result you expect, but that's anothet matter.
I must admit that for efficieny reasons the openFile in hbc does
not remember all read files, so it's not r.t. If someone is really
annoyed with this they are welcome to change the runtime system.
It looks like a couple of hours work.
-- Lennart