
Hallo, I have the following problem: my program asks the user for a command, when the command is executed a new command is asked (this is no problem ; an example is in the HUgs distribution namely Main.hs in the Prolog example. However one of the commands is: read filename i.e. read a file and display it. I do not succeed in implementing this. Could anyone give an example of: reading commands in a loop where one of the commands is the read command mentionned above. Or is it not possible in Haskell? I have already wated a lot of time on this, so if anyone gives me an answer I will be very gratefull. Greetings,

However one of the commands is: read filename i.e. read a file and display it. I do not succeed in implementing this.
http://www.haskell.org/hawiki/ThatAnnoyingIoType
http://www.haskell.org/hawiki/UsingIo
are your friends.
--KW 8-)
--
Keith Wansbrough

It would probably be helpful if you were to post the code you have and explain what part isn't working. There's a function: readFile :: FilePath -> IO String (FilePath is just a String) which reads a file. This should be what you need to solve this exercise... - Hal -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume On Mon, 2 Jun 2003, Naudts, Guido wrote:
Hallo, I have the following problem: my program asks the user for a command, when the command is executed a new command is asked (this is no problem ; an example is in the HUgs distribution namely Main.hs in the Prolog example. However one of the commands is: read filename i.e. read a file and display it. I do not succeed in implementing this. Could anyone give an example of: reading commands in a loop where one of the commands is the read command mentionned above. Or is it not possible in Haskell? I have already wated a lot of time on this, so if anyone gives me an answer I will be very gratefull. Greetings,
participants (3)
-
Hal Daume III
-
Keith Wansbrough
-
Naudts, Guido