[Haskell-cafe] ANN: conduit-network-stream, A base layer for network protocols with Conduits

Ozgun Ataman ozataman at gmail.com
Mon Feb 25 16:49:46 CET 2013


One question - and sorry that I didn't get a chance to try some examples myself - but can bi-directional conversations be carried between server/client in interleaving fashion using your library? Something like (simplified):

myClient = receive >>= send . compute

I have previously accomplished this using TBMChan and cereal-conduit to achieve the message delineation, but your library would certainly remove a layer of complexity if interleaved bi-directional talk is possible.

- Ozgun


On Monday, February 25, 2013 at 8:09 AM, Nils wrote:

> Of course you don't have to use my library if your library already 
> solves the same problem.
> 
> Am 25.02.2013 13:10, schrieb Alexander V Vershilov:
> > data Result = Error Text ByteString | NeedMore (ByteString -> Result a)
> > | HaveResult a
> > 
> 
> 
> I still see an issue with this if you're receiving multiple messages in 
> one `ByteString` chunk. A type like `HaveResult a ByteString` which also 
> returns the leftover `ByteString` after the first result has been found 
> could solve this, but you'd still have to re-yield this bytestring by 
> hand and you'll possible end up with more calls to "decode" than necessary.
> 
> Of course, with json you could avoid this problem by wrapping all 
> messages into a json-list and sending this list as one big message. But 
> that way you lose almost all advantages of a conduit - you cannot map 
> over those list iems, you cannot process each item one by one, you 
> cannot fold or filter them. When using this approach I don't really see 
> the advantage over using the plain old "connectTo/hGetContents" method?
> 
> Anyway, my library is independent of the "bytestring encoding" you want 
> to use with it. I think it's the most general solution and avoids having 
> to re-implement the same solution for each and every "protocol design" 
> over and over again.
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org (mailto:Haskell-Cafe at haskell.org)
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130225/bd142b6c/attachment-0001.htm>


More information about the Haskell-Cafe mailing list