Re: problems with working with Handles

2003-06-15 Thread Marcin 'Qrczak' Kowalczyk
Dnia pią 13. czerwca 2003 16:34, Dean Herington napisał: > `seq` guarantees only enough evaluation to determine whether its first > argument is bottom. That's why your commented code reads only the first > character. You need to evaluate the entire string. As someone else > suggested, `deepSeq`

Re: problems with working with Handles

2003-06-13 Thread Tomasz Zielonka
On Fri, Jun 13, 2003 at 10:57:21AM -0400, Dean Herington wrote: > Tomasz Zielonka wrote: > > > One can also use Strategies module that comes with GHC (in package > > concurrent), for example: > > Could you tell me more specifically where to find the Strategies module in > GHC? I couldn't find it

Re: problems with working with Handles

2003-06-13 Thread Tomasz Zielonka
On Fri, Jun 13, 2003 at 10:34:53AM -0400, Dean Herington wrote: > > `seq` guarantees only enough evaluation to determine whether its first > argument is bottom. That's why your commented code reads only the first > character. You need to evaluate the entire string. As someone else > suggested,

Re: problems with working with Handles

2003-06-13 Thread Dean Herington
Niels Reyngoud wrote: > Hello all, > > Thanks for your replies on our previous posts. To avoid the lazy > behaviour, we tried to write our own IO module "IOExts2" which basically > redifnes > readFile, writeFile and appendFile to make sure they use binary-mode and > strict behaviour. The libary is

Re: problems with working with Handles

2003-06-13 Thread Wolfgang Jeltsch
On Friday, 2003-06-13, 10:33, CEST, Niels Reyngoud wrote: > [...] > To avoid the lazy behaviour, we tried to write our own IO module "IOExts2" > which basically redifnes readFile, writeFile and appendFile to make sure > they use binary-mode and strict behaviour. The libary is as follows: > > [...]

RE: Problems with working with Handles (PS)

2003-06-13 Thread Simon Marlow
> (moderator, can you please include this mail at the bottom of my > previous mail?) > > PS: I think the next example shows pretty well what goes wrong when > you're not closing the read-handle: > > --- > test = do writeFile' "123.txt" "blaat" > > appendFile' "123.txt" " 1" > z

Re: Problems with working with Handles (PS)

2003-06-13 Thread Niels Reyngoud
(moderator, can you please include this mail at the bottom of my previous mail?) PS: I think the next example shows pretty well what goes wrong when you're not closing the read-handle: --- test = do writeFile' "123.txt" "blaat" appendFile' "123.txt" " 1" z <- readFile' "123.txt"

Re: problems with working with Handles

2003-06-13 Thread Niels Reyngoud
Hello all, Thanks for your replies on our previous posts. To avoid the lazy behaviour, we tried to write our own IO module "IOExts2" which basically redifnes readFile, writeFile and appendFile to make sure they use binary-mode and strict behaviour. The libary is as follows: -- module I

Re: problems with working with Handles

2003-06-12 Thread Dean Herington
On Thu, 12 Jun 2003, Niels Reyngoud wrote: > Hello, > > We're two students from the department of computer science at the > University of Utrecht (the Netherlands), and we're havind some severe > difficulties in working > with file handles in Haskell. Consider for example the following program

Re: problems with working with Handles

2003-06-12 Thread Keith Wansbrough
> Hello, > > We're two students from the department of computer science at the > University of Utrecht (the Netherlands), and we're havind some severe > difficulties in working > with file handles in Haskell. Consider for example the following program: > > main = do --let inputfile = "input.t

RE: problems with working with Handles

2003-06-12 Thread Markus . Schnell
> main = do --let inputfile = "input.txt" > let inputtext = "testit" > let outputfile = "output.txt" > writeFile outputfile "" > handle2 <- openFileEx outputfile (BinaryMode WriteMode) > hPutStr handle2 (inputtext ++ " extra") > > handle3 <- openFil

Re: problems with working with Handles

2003-06-12 Thread Hal Daume III
I believe this is related to the topic discussed a few weeks ago. See http://haskell.org/pipermail/haskell/2003-May/011851.html and responses. At least, this is most likely the curprit of your second problem. I'm not so sure about the first one. I would expect "testit extratestit extra2" to

problems with working with Handles

2003-06-12 Thread Niels Reyngoud
Hello, We're two students from the department of computer science at the University of Utrecht (the Netherlands), and we're havind some severe difficulties in working with file handles in Haskell. Consider for example the following program: main = do --let inputfile = "input.txt" let in