[Haskell-beginners] A first try

Yitzchak Gale gale at sefer.org
Mon Jun 27 14:33:50 CEST 2011


David Place wrote:
> Suppose the file is only partially demanded as in the case I quoted earlier.
>
> print10 =
>     do
>       contents <- withFile "/usr/share/dict/words" ReadMode (\h -> hGetContents h)
>       print $ take 10 contents
>
> The file would never be closed.

I tried it - it does close the file.

Thanks,
Yitz



More information about the Beginners mailing list