Is it possible to build in a file in a haskell program??

Alexandre Weffort Thenorio alethenorio@home.se
Tue, 29 Apr 2003 23:35:09 +0200


Yeah just as I expected it. It wrote the whole program OK but when it comes
to:

mybinfile =

It just wrote all the weird stuff that you see if you try opening a bin file
in notepad. The weird part is that it didn't write the whole thing, just
part of it. Is it supposed to be like that?? I did use readfile function to
read the bin file, but just in case how to make a handle into a string, for
example:

basic = "module MyBinFile ( mybinfile ) where\nmybinfile ::
String\nmybinfile = \""

do
handle <- openFile "mybinfile.hs" WriteMode --File to be written to
hand <- readfile "file.bin"
hPutStrLn handle (basic ++ hand ++ "\"")


That's what I did basically and I only used readFile to read the bin file
because hPutStrLn requires a String and openFile gives me a Handle so is it
possible to make a handle to a String?? Also what am I doing wrogn because
apparently I am not getting stuff like /x01/x02 but weird stuf like:

DÅÍo

in the created file.

Best Regards

Alex

----- Original Message ----- 
From: "Keith Wansbrough" <Keith.Wansbrough@cl.cam.ac.uk>
To: "Alexandre Weffort Thenorio" <alethenorio@home.se>
Sent: Tuesday, April 29, 2003 8:11 PM
Subject: Re: Is it possible to build in a file in a haskell program??


> > Thanks but I am not sure what exactly you mean. I've done this:
> [..]
> > Tried compiling main.hs file but it says "Failed to load interface for
> > MyBinFile".
>
> This means you haven't compiled MyBinFile.
>
> Do you know about Haskell modules?  You should read the relevant section
of the Haskell Report (www.haskell.org/onlinereport/), and also the
documentation of your compiler.
>
> --KW 8-)
> -- 
> Keith Wansbrough <kw217@cl.cam.ac.uk>
> http://www.cl.cam.ac.uk/users/kw217/
> University of Cambridge Computer Laboratory.
>
>