[Haskell-cafe] Automatic file closing after readFile

Jules Bean jules at jellybean.co.uk
Thu Oct 18 07:05:40 EDT 2007


> Is there some (easy) way to avoid this while still using readFile?

readFile' f = do s <- readFile f
		 return (length s `seq` s)

(and curse the fact that the default readFile is unsafelazy).

Jules


More information about the Haskell-Cafe mailing list