[Haskell-cafe] `Expect'-like lazy reading/Parsec matching on TCP sockets

Scott Bell sebell at gmail.com
Tue Apr 3 17:54:27 EDT 2007


Hello all,

I'm writing an application to interact with other applications
remotely though TCP sockets (primarily), and in the future
with local apps also.

So far I have a Parsec parser to match the input that I want
to see, which works if the remote connection is particularly
speedy - but the final goal is to obtain the following behavior:

Match the Parsec parser against the input as soon as a match
is available, but fail if the match is unavailable after a timeout
value if no further data is available on the socket.

The parser will be matching some input pattern such as
(string "login:"), for example.

What's the best approach to take while leveraging laziness if
possible?

Thanks,

- Scott Bell


More information about the Haskell-Cafe mailing list