[Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0

Bas van Dijk v.dijk.bas at gmail.com
Sat Oct 15 16:15:31 CEST 2011


On 15 October 2011 13:34, Roman Leshchinskiy <rl at cse.unsw.edu.au> wrote:
>
> On 15/10/2011, at 12:26, Roman Leshchinskiy wrote:
>
>> On 14/10/2011, at 12:37, Bas van Dijk wrote:
>>
>>> If there's need for a specific Show instance for Vectors of Word8s we
>>> can always add one directly to vector. (Roman, what are your thoughts
>>> on this?)
>>
>> Personally, I think that ByteString and especially Vector Word8 aren't strings and shouldn't be treated as such. But I wouldn't be strongly against showing them as strings. However, I *am* strongly against using UndecidableInstances in vector and I don't see how to implement this without using them.
>
> I meant OverlappingInstances, of course. To clarify, I would still consider it if everybody thinks it's a really good idea.
>
> Roman
>
>
>

I agree that you shouldn't use ByteStrings or Vectors of Word8s for
Unicode strings. However I can imagine that for quick sessions in ghci
it can be quite handy if they are shown as strings. For example,
currently we have:

> import Network.HTTP.Enumerator
> simpleHttp "http://code.haskell.org/~basvandijk/"
Chunk "<html>\n<head><title>Bas van
Dijk</title></head>\n<body>\n<h1>Bas van Dijk</h1>\n\n<p>Email: <a
href=\"mailto://v.dijk.bas@gmail.com\">v.dijk.bas at gmail.com</a></p>\n\n<p>Nick
on IRC: <tt>basvandijk</tt></p>\n\n<a
href=\"http://www.haskellers.com/user/basvandijk/\">\n  <img
src=\"http://www.haskellers.com/static/badge.png\" \n       alt=\"I'm
a Haskeller\"\n       border=\"0\">\n</a>\n\n<p>See my <a
href=\"https://github.com/basvandijk\">GitHub</a> page for a list of
projects I work on.</p>\n\n</body>\n</html>\n" Empty

If ByteStrings were not shown as strings this would look like:

Chunk ( fromList
[60,104,116,109,108,62,10,60,104,101,97,100,62,60,116,105,116,108,101,62,66,97,115,32,118,97,110,32,68,105,106,107,60,47,116,105,116,108,101,62,60,47,104,101,97,100,62,10,60,98,111,100,121,62,10,60,104,49,62,66,97,115,32,118,97,110,32,68,105,106,107,60,47,104,49,62,10,10,60,112,62,69,109,97,105,108,58,32,60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,47,47,118,46,100,105,106,107,46,98,97,115,64,103,109,97,105,108,46,99,111,109,34,62,118,46,100,105,106,107,46,98,97,115,64,103,109,97,105,108,46,99,111,109,60,47,97,62,60,47,112,62,10,10,60,112,62,78,105,99,107,32,111,110,32,73,82,67,58,32,60,116,116,62,98,97,115,118,97,110,100,105,106,107,60,47,116,116,62,60,47,112,62,10,10,60,97,32,104,114,101,102,61,34,104,116,116,112,58,47,47,119,119,119,46,104,97,115,107,101,108,108,101,114,115,46,99,111,109,47,117,115,101,114,47,98,97,115,118,97,110,100,105,106,107,47,34,62,10,32,32,60,105,109,103,32,115,114,99,61,34,104,116,116,112,58,47,47,119,119,119,46,104,97,115,107,101,108,108,101,114,115,46,99,111,109,47,115,116,97,116,105,99,47,98,97,100,103,101,46,112,110,103,34,32,10,32,32,32,32,32,32,32,97,108,116,61,34,73,39,109,32,97,32,72,97,115,107,101,108,108,101,114,34,10,32,32,32,32,32,32,32,98,111,114,100,101,114,61,34,48,34,62,10,60,47,97,62,10,10,60,112,62,83,101,101,32,109,121,32,60,97,32,104,114,101,102,61,34,104,116,116,112,115,58,47,47,103,105,116,104,117,98,46,99,111,109,47,98,97,115,118,97,110,100,105,106,107,34,62,71,105,116,72,117,98,60,47,97,62,32,112,97,103,101,32,102,111,114,32,97,32,108,105,115,116,32,111,102,32,112,114,111,106,101,99,116,115,32,73,32,119,111,114,107,32,111,110,46,60,47,112,62,10,10,60,47,98,111,100,121,62,10,60,47,104,116,109,108,62,10])
Empty

Personally, I don't work in ghci that often so I don't care that much
if we have or don't have specialized Show instances for Vectors of
Word8s.

So what do other people think about this?

Bas



More information about the Haskell-Cafe mailing list