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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to