On 10/05/2011 15:29, Max Bolingbroke wrote:
On 18 April 2011 12:48, Simon Marlow<marlo...@gmail.com>  wrote:
I'm not sure about the motivation for the factoring here,  You've added an
extra member to BufferCodec:

+  recover :: Buffer from ->  Buffer to ->  IO (Buffer from, Buffer to),

but this always seems to be instantiated by either recoverDecode or
recoverEncode.  Furthermore the Handle implementation always calls
streamEncode, which uses encode and recover in a particular way.

Right, but GHC.Foreign uses them in another way which actually makes
use of the information about why encode/decode stopped. The
streamEncode function is just a wrapper that tries to gets back the
original interface that encode/decode had before my changes, purely
for use in the Handle code. It might be possible to change Handle to
use the new encode/decode directly (and I suspect it might even clean
up the Handle code a bit). I was too afraid of the possibility of
introducing subtle new bugs in Handle to go that route right now.

I agree that it might clean up the Handle code, and I think we ought to have enough tests to catch bugs there. I'd be happy if you wanted to go that route, but alternatively if you want to leave things as they are that's fine too (would be a good idea to add a comment somewhere about this though).

Cheers,
        Simon

_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to