
On Sep 20, 2005, at 6:32 PM, Benjamin Franksen wrote:
On Tuesday 20 September 2005 16:50, John Goerzen wrote:
On the flip side, Parsec is really nice. I wonder how easy it would be to make it parse [Word8] instead of String?
Isn't Parsec parameterized over the token type?
Or even a FastPackedString? (And how easy it would be to get that instead of a String from hGetContents)?
From the FPS haddock:
hGetContents :: Handle -> IO FastString
Read entire handle contents into a FastString.
This may or may not do what you want...it's probably not a lazy read.
It seems like there might need to be something like: hGetContentsLazily :: Handle -> IO [FastString] which returns file contents in chunks based on our ability to buffer the handle. If we can mmap the handle, we may get a singleton list with a giant FastString; if we are using a Socket or a terminal, each succeeding string might be the next chunk of available data from the handle. I had the impression the internals of getContents from the prelude worked a bit like this (in GHC, anyway). -Jan-Willem Maessen
Ben _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe