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

2011-10-21 Thread Christian Maeder
Am 20.10.2011 21:43, schrieb Michael Snoyman: On Wed, Oct 19, 2011 at 9:29 PM, Ketil Maldeke...@malde.org wrote: Michael Snoymanmich...@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

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

2011-10-21 Thread Michael Snoyman
On Fri, Oct 21, 2011 at 11:58 AM, Christian Maeder christian.mae...@dfki.de wrote: Am 20.10.2011 21:43, schrieb Michael Snoyman: On Wed, Oct 19, 2011 at 9:29 PM, Ketil Maldeke...@malde.org  wrote: Michael Snoymanmich...@snoyman.com  writes: sense to try and pursue something like what you're

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

2011-10-20 Thread Michael Snoyman
On Wed, Oct 19, 2011 at 9:29 PM, Ketil Malde ke...@malde.org wrote: Michael Snoyman mich...@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

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

2011-10-19 Thread Roman Leshchinskiy
Conrad Parker wrote: On 15 October 2011 23:18, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 16 October 2011 01:15, Bas van Dijk v.dijk@gmail.com wrote: I agree that you shouldn't use ByteStrings or Vectors of Word8s for Unicode strings. However I can imagine that for quick

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

2011-10-19 Thread Ivan Lazar Miljenovic
On 19 October 2011 22:09, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: So it seems that (1) people have very different requirements and (2) the Show instance only really matters for debugging in ghci. Here is a thought. What if ghci allowed Show instances to be overridden dynamically? So

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

2011-10-19 Thread Michael Snoyman
On Wed, Oct 19, 2011 at 1:09 PM, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: So it seems that (1) people have very different requirements and (2) the Show instance only really matters for debugging in ghci. Here is a thought. What if ghci allowed Show instances to be overridden

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

2011-10-19 Thread AM
On Oct 19, 2011, at 7:32 AM, Ivan Lazar Miljenovic wrote: On 19 October 2011 22:09, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: So it seems that (1) people have very different requirements and (2) the Show instance only really matters for debugging in ghci. Here is a thought. What if

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

2011-10-19 Thread Stephen Tetley
On 19 October 2011 15:59, AM age...@themactionfaction.com wrote: Note that other programming languages have had to solve this exact problem and they usually end up with multiple functions- one for debugging, one for serialization, one for displaying how the object was constructed. As per

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

2011-10-19 Thread Evan Laforge
On Wed, Oct 19, 2011 at 9:49 AM, Stephen Tetley stephen.tet...@gmail.com wrote: On 19 October 2011 15:59, AM age...@themactionfaction.com wrote: Note that other programming languages have had to solve this exact problem and they usually end up with multiple functions- one for debugging, one

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

2011-10-19 Thread Roman Leshchinskiy
Ivan Lazar Miljenovic wrote: On 19 October 2011 22:09, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: So it seems that (1) people have very different requirements and (2) the Show instance only really matters for debugging in ghci. Here is a thought. What if ghci allowed Show instances to be

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

2011-10-19 Thread Ketil Malde
Michael Snoyman mich...@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.

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

2011-10-18 Thread Vincent Hanquez
On 10/18/2011 01:30 AM, Conrad Parker wrote: And I often work with mixed text/binary data (eg. text annotations in video streams). I'd want the Show/Read instances to be in the form of a hexdump with char representation alongside (like xxd or od -xc output). It roundtrips well, so why not? :-)

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

2011-10-18 Thread Christian Maeder
Am 12.10.2011 16:02, schrieb Bas van Dijk: API DOCS http://hackage.haskell.org/package/vector-bytestring-0.0.0.0 you could re-export VS.empty, VS.singleton, etc. directly. Cheers Christian -- | /O(1)/ The empty 'ByteString' empty :: ByteString empty = VS.empty {-# INLINE empty #-} -- |

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

2011-10-18 Thread Roel van Dijk
2011/10/18 Christian Maeder christian.mae...@dfki.de: you could re-export VS.empty, VS.singleton, etc. directly. The vector singleton and the vector-bytestring singleton don't have the same type. vector: singleton :: a - Vector a vector-bytestring: singleton :: Word8 - Vector Word8 By

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

2011-10-18 Thread Roel van Dijk
2011/10/18 Roel van Dijk vandijk.r...@gmail.com: Maybe we [can] create an example program which would fail with the more general type. Migrating the function foo from bytestring to vector-bytestring would fail with more general types: import Data.ByteString foo = print empty Ok, modules

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

2011-10-17 Thread Christian Maeder
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 constructor - is portable and supplies control over all other instances

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

2011-10-17 Thread Yves Parès
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.mae...@dfki.de I think the cleanest solution (just from a theoretical point

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

2011-10-17 Thread Ertugrul Soeylemez
Christian Maeder christian.mae...@dfki.de wrote: 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 constructor - is

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

2011-10-17 Thread Christian Maeder
Am 17.10.2011 11:10, schrieb Ertugrul Soeylemez: So please, please, please, if you decide to use a newtype, do /not/ hide the constructor. The better alternative to not hiding the constructor is to supply conversion functions that may or may not do more than the constructor and selector and

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

2011-10-17 Thread Bas van Dijk
On 17 October 2011 10:18, Christian Maeder christian.mae...@dfki.de wrote: 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

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

2011-10-17 Thread Michael Snoyman
On Mon, Oct 17, 2011 at 12:14 PM, Bas van Dijk v.dijk@gmail.com wrote: On 17 October 2011 10:18, Christian Maeder christian.mae...@dfki.de wrote: 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

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

2011-10-17 Thread Jean-Marie Gaillourdet
Hi, On 17.10.2011, at 12:14, Bas van Dijk wrote: On 17 October 2011 10:18, Christian Maeder christian.mae...@dfki.de wrote: My idea is that when vector-bytestring is as fast as bytestring, it can replace it. When that happens it doesn't matter if users use the vector interface. I would

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

2011-10-17 Thread Christian Maeder
Am 17.10.2011 12:14, schrieb Bas van Dijk: On 17 October 2011 10:18, Christian Maederchristian.mae...@dfki.de wrote: 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

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

2011-10-17 Thread Christian Maeder
Am 17.10.2011 12:19, schrieb Michael Snoyman: [...] Also, aren't there a few documented cases where newtypes prevent certain GHC rewrite rules from firing? This would be possible to find out with a wrapper module. Cheers Christian I don't see any strong argument to avoid what appears to be

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

2011-10-17 Thread Ertugrul Soeylemez
Christian Maeder christian.mae...@dfki.de wrote: So please, please, please, if you decide to use a newtype, do /not/ hide the constructor. The better alternative to not hiding the constructor is to supply conversion functions that may or may not do more than the constructor and selector

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

2011-10-17 Thread Roman Leshchinskiy
Michael Snoyman wrote: On Mon, Oct 17, 2011 at 12:14 PM, Bas van Dijk v.dijk@gmail.com wrote: My idea is that when vector-bytestring is as fast as bytestring, it can replace it. When that happens it doesn't matter if users use the vector interface. I would even recommend it over using

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

2011-10-17 Thread Michael Snoyman
On Mon, Oct 17, 2011 at 4:42 PM, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: Michael Snoyman wrote: On Mon, Oct 17, 2011 at 12:14 PM, Bas van Dijk v.dijk@gmail.com wrote: My idea is that when vector-bytestring is as fast as bytestring, it can replace it. When that happens it doesn't

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

2011-10-17 Thread Bas van Dijk
On 17 October 2011 16:44, Michael Snoyman mich...@snoyman.com wrote: On Mon, Oct 17, 2011 at 4:42 PM, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: Michael Snoyman wrote: On Mon, Oct 17, 2011 at 12:14 PM, Bas van Dijk v.dijk@gmail.com wrote: My idea is that when vector-bytestring is

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

2011-10-17 Thread Bas van Dijk
On 17 October 2011 13:12, Christian Maeder christian.mae...@dfki.de wrote: Am 17.10.2011 12:14, schrieb Bas van Dijk: On 17 October 2011 10:18, Christian Maederchristian.mae...@dfki.de  wrote: I think the cleanest solution (just from a theoretical point of view) is to use a newtype for

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

2011-10-17 Thread Christian Maeder
Am 17.10.2011 17:26, schrieb Bas van Dijk: On 17 October 2011 13:12, Christian Maederchristian.mae...@dfki.de wrote: So your package basically supports an unfortunate mix of bytestring and vector functions? No, vector-bytestring exports the same API as bytestring (except for the Show and

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

2011-10-17 Thread Yves Parès
It's a good question, I don't think there is something in the vector library that can handle chunks of vectors... If both lazy and strict bytestrings are to be generalized, it would *at last * permit to have a single interface to them, thanks to Data.Vector.Generic, and no longer two identical

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

2011-10-17 Thread Bas van Dijk
On 17 October 2011 20:15, Yves Parès limestr...@gmail.com wrote: It's a good question, I don't think there is something in the vector library that can handle chunks of vectors... Yes I forgot about lazy bytestrings when writing that. Of course vector-bytestring does provide lazy ByteStrings.

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

2011-10-17 Thread Bas van Dijk
On 17 October 2011 18:28, Christian Maeder christian.mae...@dfki.de wrote: Am 17.10.2011 17:26, schrieb Bas van Dijk: On 17 October 2011 13:12, Christian Maederchristian.mae...@dfki.de  wrote: So your package basically supports an unfortunate mix of bytestring and vector functions? No,

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

2011-10-17 Thread Conrad Parker
On 15 October 2011 23:18, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 16 October 2011 01:15, Bas van Dijk v.dijk@gmail.com wrote: 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

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

2011-10-17 Thread Felipe Almeida Lessa
On Mon, Oct 17, 2011 at 10:30 PM, Conrad Parker con...@metadecks.org wrote: And I often work with mixed text/binary data (eg. text annotations in video streams). I'd want the Show/Read instances to be in the form of a hexdump with char representation alongside (like xxd or od -xc output). It

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

2011-10-16 Thread Stephen Tetley
On 15 October 2011 23:56, Bas van Dijk v.dijk@gmail.com wrote: On 15 October 2011 23:17, Ertugrul Soeylemez e...@ertes.de wrote: Both instances are valid here, and there is no mechanism to choose one of them. There is: OverlappingInstances[1] chooses the most specific instance. So in

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

2011-10-16 Thread Bas van Dijk
On 16 October 2011 08:51, Stephen Tetley stephen.tet...@gmail.com wrote: On 15 October 2011 23:56, Bas van Dijk v.dijk@gmail.com wrote: On 15 October 2011 23:17, Ertugrul Soeylemez e...@ertes.de wrote: Both instances are valid here, and there is no mechanism to choose one of them. There

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

2011-10-16 Thread Stephen Tetley
On 16 October 2011 10:06, Bas van Dijk v.dijk@gmail.com wrote: But is this a problem when both instances are exported from the same module and OverlappingInstances is only enabled in that module, as is the case here? No - if the only instances defined are in the same module GHC would

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

2011-10-16 Thread Ertugrul Soeylemez
Bas van Dijk v.dijk@gmail.com wrote: On 15 October 2011 23:17, Ertugrul Soeylemez e...@ertes.de wrote: Both instances are valid here, and there is no mechanism to choose one of them. There is: OverlappingInstances[1] chooses the most specific instance. So in case someVector :: Vector

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

2011-10-16 Thread Ertugrul Soeylemez
Felipe Almeida Lessa felipe.le...@gmail.com wrote: Although I don't have a problem with using language extensions the vector package, as it is a commonly used tool, shouldn't require me to use an extension just to be able to debug my code.  This would be particularly annoying when using

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

2011-10-15 Thread Roman Leshchinskiy
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

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

2011-10-15 Thread Roman Leshchinskiy
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

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

2011-10-15 Thread Bas van Dijk
On 15 October 2011 13:34, Roman Leshchinskiy r...@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

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

2011-10-15 Thread Joachim Breitner
Hi, Am Samstag, den 15.10.2011, 16:15 +0200 schrieb Bas van Dijk: So what do other people think about this? having a human-readable Show instance for ByteStrings is definitely a great plus when debugging code. Greetings, Joachim -- Joachim nomeata Breitner m...@joachim-breitner.de |

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

2011-10-15 Thread Ivan Lazar Miljenovic
On 16 October 2011 01:15, Bas van Dijk v.dijk@gmail.com wrote: 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:

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

2011-10-15 Thread Ertugrul Soeylemez
Joachim Breitner m...@joachim-breitner.de wrote: So what do other people think about this? having a human-readable Show instance for ByteStrings is definitely a great plus when debugging code. I agree and would even go as far as saying that it's generally useful, even if the data is not

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

2011-10-15 Thread Bas van Dijk
On 15 October 2011 20:50, Ertugrul Soeylemez e...@ertes.de wrote: Roman Leshchinskiy r...@cse.unsw.edu.au wrote: 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.

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

2011-10-15 Thread Ertugrul Soeylemez
Bas van Dijk v.dijk@gmail.com wrote: My suggestion was to remove the generic Show instance and add only specialized instances.  This is more work, but will also yield better results.  In particular, it allows specialized string representations for other types, too. What exactly is

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

2011-10-15 Thread Bas van Dijk
On 15 October 2011 23:17, Ertugrul Soeylemez e...@ertes.de wrote: Both instances are valid here, and there is no mechanism to choose one of them. There is: OverlappingInstances[1] chooses the most specific instance. So in case someVector :: Vector Word8 the instance Show (Vector Word8) is

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

2011-10-14 Thread Christian Maeder
Am 12.10.2011 16:02, schrieb Bas van Dijk: All your ByteString are belong to us... Hello, I'm pleased to announce the beta release of vector-bytestring. This library provides the type ByteString which is defined as a type synonym for a storable Vector of Word8s (from the vector package):

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

2011-10-14 Thread Bas van Dijk
On 14 October 2011 12:58, Christian Maeder christian.mae...@dfki.de wrote: Would it not be simple to use a newtype for ByteString (rather than a synonym)? My vision for the future of bytestring and vector-bytestring is that they will be replaced by vector directly. This way users don't have to

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

2011-10-14 Thread Ivan Lazar Miljenovic
On 14 October 2011 22:37, Bas van Dijk v.dijk@gmail.com wrote: On 14 October 2011 12:58, Christian Maeder christian.mae...@dfki.de wrote: Would it not be simple to use a newtype for ByteString (rather than a synonym)? If there's need for a specific Show instance for Vectors of Word8s we

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

2011-10-14 Thread Max Rabkin
On Fri, Oct 14, 2011 at 13:45, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Though I would argue that unless you're trying to actually use for Show/Read for serialisation, does it really matter what the Show/Read instances for Bytestring are? Convenient debugging and REPL interaction

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

2011-10-14 Thread Ertugrul Soeylemez
Max Rabkin max.rab...@gmail.com wrote: Though I would argue that unless you're trying to actually use for Show/Read for serialisation, does it really matter what the Show/Read instances for Bytestring are? Convenient debugging and REPL interaction certainly matter! On the other hand,

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

2011-10-14 Thread Bas van Dijk
On 14 October 2011 13:37, Bas van Dijk v.dijk@gmail.com 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?) Ok I have proposed and implemented this for vector:

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

2011-10-12 Thread Bas van Dijk
All your ByteString are belong to us... Hello, I'm pleased to announce the beta release of vector-bytestring. This library provides the type ByteString which is defined as a type synonym for a storable Vector of Word8s (from the vector package): type ByteString = Data.Vector.Storable.Vector