New to Haskell - Question about hugsIORun from old Prelude

Hello, I am trying to rewrite some older (2001) haskell : myReadFile :: String -> String myReadFile f = case hugsIORun (readFile f) of Right s -> s Left _ -> "" Can someone provide me with a up to date version of the above bit of code without using code from the old Prelude? Thanks, R _________________________________________________________________ Visit MSN Holiday Challenge for your chance to win up to $50,000 in Holiday cash from MSN today! http://www.msnholidaychallenge.com/index.aspx?ocid=tagline&locale=en-us

The current necromancy would probably be:
import System.IO.Unsafe import System.IO
myReadFile :: String -> String myReadFile fname = unsafePerformIO $ readFile fname `catch` const (return "")
On which subject allow me to comment that zombies smell bad.
/g
On 12/11/06, Rahul Naik
Hello,
I am trying to rewrite some older (2001) haskell :
myReadFile :: String -> String myReadFile f = case hugsIORun (readFile f) of Right s -> s Left _ -> ""
Can someone provide me with a up to date version of the above bit of code without using code from the old Prelude?
Thanks,
R
_________________________________________________________________ Visit MSN Holiday Challenge for your chance to win up to $50,000 in Holiday cash from MSN today! http://www.msnholidaychallenge.com/index.aspx?ocid=tagline&locale=en-us
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- It is myself I have never met, whose face is pasted on the underside of my mind.

On Mon, 11 Dec 2006, Rahul Naik wrote:
Hello,
I am trying to rewrite some older (2001) haskell :
myReadFile :: String -> String myReadFile f = case hugsIORun (readFile f) of Right s -> s Left _ -> ""
Can someone provide me with a up to date version of the above bit of code without using code from the old Prelude?
participants (3)
-
Henning Thielemann
-
J. Garrett Morris
-
Rahul Naik