Yes you are right (I tested with openFile in TextMode) but as far as I can see openFile cannot be changed to any other mode than TextMode thus openFile does not work with binary files (.bin) whereas openFileEx can be set to BinaryMode instead of TextMode which gives me the right output. Thanks for pointing it out. Why isn't IO and IOExts put together in one library. For example functions like openFile can be rewritten to work the same way as openFileEx thus eliminating one function and making it easier for the user not to have to compile the program with lang package. Best Regards NooK ----- Original Message ----- From: "Derek Elkins" <ddarius@hotpop.com> To: <haskell@haskell.org> Sent: Wednesday, April 30, 2003 3:41 PM Subject: Re: Is it possible to build in a file in a haskell program??
On Wed, 30 Apr 2003 15:29:05 +0200 "Alexandre Weffort Thenorio" <alethenorio@home.se> wrote:
Thanks a lot guys. "Show" seems to have solved the problem. The only weird thing is that created file is not exactly the same size (100 bytes bigger) but hopefully that should not be a problem. Just would like to point that openFile function from IO library did not write the right string representation (Just small part of it) while openFileEx in IOExts library did write the whole thing. Maybe it is a bug? As a last question I am curious about a thing you guys typed a lot latelly, What does the $ sign(Dollar) does??
Thanks again
Alex
If the file is opened in text mode it will stop at the first EOF character in the output. I imagine that that was the problem with openFile.
$ is just a low precedence right associative function application. It's mainly used to avoid parentheses. It's definition is f $ x = f x. You can change something like f (g (h x)) into f $ g $ x.
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell