
2 Feb
2007
2 Feb
'07
11:03 p.m.
Hey there, A few weeks back I was thinking of writing a Haskell program that automated a telnet session. One function that could be useful is a hReadUntilStr - that is, a function that takes a Handle as an input source, a String to match, and a "Num a" as the number of seconds to wait before returning a (String, Bool) where the String is all the text read from the Handle until either matching or timing out and the Bool is true if the input String was matched. Something like: hReadUntilStr :: (Num a) => Handle -> String -> a -> IO (String, Bool) Is this the wrong way to think about the problem? If so, how should it be handled? If not, any ideas on the implementation? Any advice is appreciated. Cheers, Matt