[Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0
limestrael at gmail.com
Mon Oct 17 11:03:04 CEST 2011
And you could just use GeneralizedNewtypeDeriving extension. Then you could
use functions from Data.Vector.Generic on your ByteStrings.
Much cleaner IMO than OverlappingInstances.
2011/10/17 Christian Maeder <Christian.Maeder at dfki.de>
> I think the cleanest solution (just from a theoretical point of view) is to
> use a newtype for your byte strings.
> - it should have the same performance
> - allows to make ByteString really abstract when hiding the newtype
> - is portable and supplies control over all other instances (not just Show)
> I'm not sure if one could make really bad thinks to your ByteString by
> using the Vector interface, but one would want to disallow vector operations
> just for compatible with other byte strings.
> It would require more work just on your side, though.
> Cheers Christian
> Am 15.10.2011 16:15, schrieb Bas van Dijk:
> On 15 October 2011 13:34, Roman Leshchinskiy<rl at cse.unsw.edu.**au<rl at cse.unsw.edu.au>>
>>> 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.
>> 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/<http://code.haskell.org/%7Ebasvandijk/>
>> 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>\">
>> v.dijk.bas at gmail.**com <v.dijk.bas at gmail.com></a></p>\n\n<p>Nick
>> on IRC:<tt>basvandijk</tt></p>\n\**n<a
>> \n alt=\"I'm
>> a Haskeller\"\n border=\"0\">\n</a>\n\n<p>See my<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
>> 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
>> So what do other people think about this?
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe