
Hello Scott, Wednesday, April 4, 2007, 6:39:22 PM, you wrote:
vGetChar (StreamWithTimeout s t) = do timeout t (vGetChar s) (error "Timed out!")
If possible, I would like to try and use lazy [Char]s -- this would greatly simplify my usage of the Parsec parser.
or, even simple, you can make your own variant of hGetContents which adds a timeout checks before each next call to hGetChar or hGetBuf
Can this be as simple as applying the parser against a string returned by the (modified) hGetContents, which will read all that is possible given a certain time constraint?
yes, with both variants. actually, second one should be easier to implement and understand. you should look into unsafeInterleaveIO section of http://haskell.org/haskellwiki/IO_inside feel free to ask me if you need more help -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com