John Goerzen writes:
That failed, though, because getContents closes the file
after it's been completely read (ugh -- why?).
getContents reads from standard input: you can't seek on
that stream. Just think of cat file | cat. The second
invocation reads from a pipe, not from a file on disk.
On 2004-09-28, Peter Simons [EMAIL PROTECTED] wrote:
John Goerzen writes:
That failed, though, because getContents closes the file
after it's been completely read (ugh -- why?).
You could read the contents once, write it to a temporary
file, and then copy it multiple times from there.
On 2004-09-28 at 21:19- John Goerzen wrote:
On 2004-09-28, Peter Simons [EMAIL PROTECTED] wrote:
John Goerzen writes:
FWIW, this is working for me:
import IO
main = disp 100
disp 0 = return ()
disp n =
let copy x = do
eof - isEOF
if eof
On Tuesday 28 September 2004 22:19, John Goerzen wrote:
[program that calls isEOF once per line deleted]
but it seems wasteful to poll isEOF so much.
I think all Haskell implementations have a buffering layer between the Haskell
level and the operating system. So, calls to hGetLine, hIsEOF,
On 2004-09-28, Alastair Reid [EMAIL PROTECTED] wrote:
On Tuesday 28 September 2004 22:19, John Goerzen wrote:
That said, if you want to write a cat-like program which is as fast as Unix
cat, you should not process data a character at a time or a line at a time
but, rather, read fixed size
John Goerzen writes:
One of the things I do when I learn a new language is to try to probe
where its weaknesses are.
Please, when meeting new women in your life, don't do so.
Otherwise you won't live long enough in order to appreciate
your new knowledge...
Jerzy Karczmarczuk