[Haskell-cafe] Re: Left fold enumerator - a real pearl overlooked?
Manlio Perillo
manlio_perillo at libero.it
Mon Mar 2 06:00:50 EST 2009
Eugene Kirpichov ha scritto:
> OK, I'm far from being a supergeek, but anyways.
>
> I'm not considering the lazy IO approach, as it doesn't involve any
> form of control over resources.
This is not always true.
I'm using lazy IO, still having full control over the resources.
parse path = withFile path ReadMode parse'
where
parse' :: Handle -> IO (UArr Xxx)
parse' handle = do
contents <- L.hGetContents handle
let v = toU $ xxx $ L.lines contents
rnf v `seq` return v
All the file is consumed, before the result is returned.
> [...]
Manlio Perillo
More information about the Haskell-Cafe
mailing list