Changing the API of the network package to use ByteStrings instead of Strings

Sterling Clover s.clover at gmail.com
Sun Oct 31 13:28:44 EDT 2010


On Oct 31, 2010, at 11:38 AM, Johan Tibell wrote:
> I see two basic approaches:
>
> 1. Warn people of the upcoming change e.g. 6 months in advance, and
> then just change the types as part of a HP release. Delete the
> *.ByteString modules.
>
> 2. Deprecate the String based functions using pragmas, slowly move
> people over to the ByteString based ones. When everyone has moved
> over, change the types of the original functions to also use
> ByteStrings. Slowly migrate people back to the old functions (that now
> have a different type). Delete the *.ByteString modules.

A slightly more involved, but perhaps less painful proposal:

Add a Network.Socket.String (or Network.Socket.OldStrings, or..)
module as soon as possible, which just exports the old functions. At
some near-future point, deprecate the String based functions from
Network.ByteString, and encourage people to move to the ByteString
based functions. At some further future point, change original
functions to the ByteString version. Finally, eventually delete both
the *.ByteString modules and throw the String based functions (ideally
now wrappers of the ByteString ones) into a separate
network-oldstring-compat library.

That's essentially the Exceptions/OldExceptions model, I think (maybe
with a few more steps even), and that was about as smooth as a major
API transition has been.

Cheers,
Sterl.

P.S. Apologies if this is a double-send to anyone -- my mail client hiccuped.


More information about the Libraries mailing list