Hello.

I've tried to combine lazy IO and parsec. The hole process is done by
network.

Currently I have implemented 'short parsers' so I enter them on need. To
update state I have following code:
parser2nntp :: Monad m => NntpParser m a -> NntpT m a
parser2nntp p = do s <- NntpT (gets $ input . connection)
                   e <- runParserT (do v <- p
                                       i <- getInput
                                       return (v, i)) () "" s
                   case e of
                     Left er -> error $ show er
                     Right (v, i') -> (NntpT (modify (pNI i')) >> return
v)
                where pNI :: Monad m => ByteString ->NntpState m ->
NntpState m
                      pNI i s = s {connection = (connection s) {input =
i}}


However the 4 line (i <- getInput) blocks the execution as trace
indicated. String returned have no input available so it should block on
evaluation - and here I pass only a reference to it (or rather I think
so). What's wrong? 

PS. Full code is in darsc nntp repository http://code.haskell.org/nntp/
- please note that it seems to require network compiled against parsec 3
- not 2.

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to