[Haskell-cafe] ANNOUNCE: vector-bytestring-

Michael Snoyman michael at snoyman.com
Fri Oct 21 12:32:15 CEST 2011

On Fri, Oct 21, 2011 at 11:58 AM, Christian Maeder
<Christian.Maeder at dfki.de> wrote:
> Am 20.10.2011 21:43, schrieb Michael Snoyman:
>> On Wed, Oct 19, 2011 at 9:29 PM, Ketil Malde<ketil at malde.org>  wrote:
>>> Michael Snoyman<michael at snoyman.com>  writes:
>>>> sense to try and pursue something like what you're suggesting, but I
>>>> think the default Show (Vector Word8) should be the one most useful,
>>>> most of the time, and I think the general consensus seems to be the
>>>> current ByteString instance fits that role.
>>> Hm.  I think it is slightly weird to display a numeric value (Word8) as
>>> a Char.  Also, I would prefer a representation making the type explicit
>>> (but unlike ByteString, vector seems to add a type annotation.)  Would
>>> you still support the truncating behavior for 'read' and values above
>>> 255?
>>> (ByteString has two interfaces, ByteString and .Char8, but as there can
>>> be only one Show instance, I see why it works the way it does.)
>> Perhaps the correct semantic approach would be to have:
>>     newtype Char8 = Char8 Word8
>> But I think that will break far too many applications to try to get it
> would a new Word8 type be better to stay compatible?
>       newtype Word8 = C8 Data.Word.Word8

I don't think it would really fix much. Any code in the wild right now
that refers to Word8 will be referring to Data.Word.Word8. Certainly
calling the newtype Word8 will slightly simplify a migration, but (1)
it will still require code changes and (2) I'd rather just bite the
bullet and make a proper switch.


More information about the Haskell-Cafe mailing list