[Haskell-cafe] lazy readFile

2005-01-03 Thread Henning Thielemann

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? 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] lazy readFile

2005-01-03 Thread David Sabel
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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe