[Haskell-cafe] lazy readFile
David Sabel
sabel at ki.informatik.uni-frankfurt.de
Mon Jan 3 13:51:58 EST 2005
Hi!
>I'm also interested, how to get this example working:
>
>http://www.haskell.org/pipermail/haskell/2001-November/008336.html
>
>This seems to be an old discussion:
>
>http://www.haskell.org/pipermail/libraries/2001-April/000358.html
>
>Was a strictReadFile implemented in the meantime?
>
>
Here's my implementation of strictReadFile:
import System.IO
strictReadFile path = do
handle <- openFile path ReadMode
strictReadFromHandle handle
strictReadFromHandle handle =
do
eof <- hIsEOF handle
if eof then
do
hClose handle
return []
else
do
c <- hGetChar handle
y <- strictReadFromHandle handle
return (c:y)
Cheers,
David
More information about the Haskell-Cafe
mailing list