Re: Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-14 Thread Duncan Coutts
On Tue, 2009-03-10 at 23:55 +0300, Bulat Ziganshin wrote: starting with 6.6, ForeignArray access is no-op, so we can just use obvious Ptr operations (via Storable class) to get unboxed arrays fast access. so, no more need for those special ByteArray# access operations but Array library

Re: Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-14 Thread Duncan Coutts
On Fri, 2009-03-13 at 20:30 +0300, Bulat Ziganshin wrote: Hello Don, Friday, March 13, 2009, 8:08:57 PM, you wrote: What is the reason why you have decided to use unpinned arrays (ByteArray#) instead of pinned arrays (Foreign.Ptr)? They prevent heap fragmentation (and in general are

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-14 Thread Duncan Coutts
On Mon, 2009-03-09 at 18:29 -0700, Alexander Dunlap wrote: Thanks for all of the responses! So let me see if my summary is accurate here: - ByteString is for just that: strings of bytes, generally read off of a disk. The Char8 version just interprets the Word8s as Chars but doesn't do

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Manlio Perillo
Don Stewart ha scritto: [...] I think uvector only works with certain types that can be unboxed, while storablevector works with all types that instantiate Foreign.Storable.Storable. I don't know about vector. From the description of vector, I have the One of the nice feature of uvector

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Manlio Perillo
Don Stewart ha scritto: bulat.ziganshin: Hello Don, Wednesday, March 11, 2009, 12:12:07 AM, you wrote: Right, so my point stands: there's no difference now. If you can write a Storable instance, you can write a UA et al instance. yes, if there is some class provided for this and not just

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Manlio Perillo
Manlio Perillo ha scritto: [...] uvector package also suppors Complex and Rational, however the support for these type is hard written, using a UAProd class, and requires some boiler plate code (IMHO). Correction: UAProd is not a class, sorry. It is the UA constructor overloaded for a:*:b,

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Don Stewart
manlio_perillo: Don Stewart ha scritto: bulat.ziganshin: Hello Don, Wednesday, March 11, 2009, 12:12:07 AM, you wrote: Right, so my point stands: there's no difference now. If you can write a Storable instance, you can write a UA et al instance. yes, if there is some class provided for

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Manlio Perillo
Don Stewart ha scritto: [...] You also have to add instance for UIO: instance (RealFloat a, UIO a) = UIO (Complex a) where hPutU h (UAComplex arr) = hPutU h arr hGetU h = do arr - hGetU h return (UAComplex arr) With

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Manlio Perillo
Bryan O'Sullivan ha scritto: [...] text is not mature, and is based on the same modern fusion framework as uvector and vector. It uses unpinned arrays, but provides functions for dealing with foreign code. What is the reason why you have decided to use unpinned arrays (ByteArray#) instead

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Don Stewart
manlio_perillo: Bryan O'Sullivan ha scritto: [...] text is not mature, and is based on the same modern fusion framework as uvector and vector. It uses unpinned arrays, but provides functions for dealing with foreign code. What is the reason why you have decided to use unpinned arrays

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Bulat Ziganshin
Hello Don, Friday, March 13, 2009, 8:08:57 PM, you wrote: What is the reason why you have decided to use unpinned arrays (ByteArray#) instead of pinned arrays (Foreign.Ptr)? They prevent heap fragmentation (and in general are faster). you probably mean faster alloc/gc operations, everything

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Henning Thielemann
On Mon, 9 Mar 2009, Alexander Dunlap wrote: - uvector, storablevector and vector are all designed for dealing with arrays. They *can* be used for characters/word8s but are not specialized for that purpose, do not deal with Unicode at all, and are probably worse at it. They are better for

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Don Stewart
xj2106: Alexander Dunlap alexander.dun...@gmail.com writes: - uvector, storablevector and vector are all designed for dealing with arrays. They *can* be used for characters/word8s but are not specialized for that purpose, do not deal with Unicode at all, and are probably worse at it.

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Don, Tuesday, March 10, 2009, 10:40:30 PM, you wrote: I think uvector only works with certain types that can be unboxed, while storablevector works with all types that instantiate Foreign.Storable.Storable. I don't know about vector. From the description of vector, I have the

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Don Stewart
bulat.ziganshin: Hello Don, Tuesday, March 10, 2009, 10:40:30 PM, you wrote: I think uvector only works with certain types that can be unboxed, while storablevector works with all types that instantiate Foreign.Storable.Storable. I don't know about vector. From the description of

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Xiao-Yong Jin
Don Stewart d...@galois.com writes: And what is Storable limited to? Ultimately they're all limited to the primops for reading and writing, and to what types we can encode in those. So: primop ReadOffAddrOp_Char readCharOffAddr# GenPrimOp ... {- instance Storable Double instance

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Don, Tuesday, March 10, 2009, 11:01:31 PM, you wrote: if uavector use ghc's built-in unboxed array operations (as Data.Array.Unboxed does) then it's necessarily bounded to types supported by those operations And what is Storable limited to? Ultimately they're all limited to the

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Xiao-Yong, Tuesday, March 10, 2009, 11:52:50 PM, you wrote: So it's me who understand it wrong. If I want some high performance array with elements of custom data type, I'm stuck with Array, anyway? ForeignArray will be the best here. just make you type instance of Storable. if you

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Don Stewart
bulat.ziganshin: Hello Don, Tuesday, March 10, 2009, 11:01:31 PM, you wrote: if uavector use ghc's built-in unboxed array operations (as Data.Array.Unboxed does) then it's necessarily bounded to types supported by those operations And what is Storable limited to? Ultimately

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Don Stewart
xj2106: Don Stewart d...@galois.com writes: And what is Storable limited to? Ultimately they're all limited to the primops for reading and writing, and to what types we can encode in those. So: primop ReadOffAddrOp_Char readCharOffAddr# GenPrimOp ... {- instance

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Don, Wednesday, March 11, 2009, 12:12:07 AM, you wrote: Right, so my point stands: there's no difference now. If you can write a Storable instance, you can write a UA et al instance. yes, if there is some class provided for this and not just hard-coded 4 or so base types And GHC 6.6

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Xiao-Yong Jin
Don Stewart d...@galois.com writes: instance UA UserDefinedDataType I'm not sure how to do that. Can you give me some clarification? Yes, you can do that. This is the case for most of the new array libraries. It goes beyond my current knowledge, now. How do you define a custom data

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Don Stewart
bulat.ziganshin: Hello Don, Wednesday, March 11, 2009, 12:12:07 AM, you wrote: Right, so my point stands: there's no difference now. If you can write a Storable instance, you can write a UA et al instance. yes, if there is some class provided for this and not just hard-coded 4 or so

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Xiao-Yong, Wednesday, March 11, 2009, 12:28:45 AM, you wrote: It goes beyond my current knowledge, now. How do you define a custom data type as an instance of UA or Storable? just look at existing instances. basically, for complex data type, you just use instances for its basic types,

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Don, Wednesday, March 11, 2009, 12:48:35 AM, you wrote: unfortunately, Array library unboxed arrays still aren't based on any Unboxable *class* Hmm. Aren't all the array library types based on MArray and IArray? So I can define my own say, new STUArray element type by writing an

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Don Stewart
bulat.ziganshin: Hello Don, Wednesday, March 11, 2009, 12:48:35 AM, you wrote: unfortunately, Array library unboxed arrays still aren't based on any Unboxable *class* Hmm. Aren't all the array library types based on MArray and IArray? So I can define my own say, new STUArray

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Xiao-Yong Jin
Hi, thanks for the hint. I'll see what I can do with it. Xiao-Yong Bulat Ziganshin bulat.zigans...@gmail.com writes: Hello Xiao-Yong, Wednesday, March 11, 2009, 12:28:45 AM, you wrote: It goes beyond my current knowledge, now. How do you define a custom data type as an instance of UA or

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-09 Thread Henning Thielemann
On Sat, 7 Mar 2009, Bryan O'Sullivan wrote: On Sat, Mar 7, 2009 at 10:23 PM, Alexander Dunlap alexander.dun...@gmail.com wrote: Hi all, For a while now, we have had Data.ByteString[.Lazy][.Char8] for our fast strings. Now we also have Data.Text, which does the same for

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-09 Thread Henning Thielemann
On Mon, 9 Mar 2009, Claus Reinke wrote: Given the close relationship between uvector and vector, it would be very helpful if both package descriptions on hackage could point to a common haskell wiki page, starting out with the text and link above, plus a link to the stream fusion paper (I

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-09 Thread Alexander Dunlap
On Mon, Mar 9, 2009 at 3:12 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Mon, 9 Mar 2009, Claus Reinke wrote: Given the close relationship between uvector and vector, it would be very helpful if both package descriptions on hackage could point to a common haskell wiki page,

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-09 Thread Xiao-Yong Jin
Alexander Dunlap alexander.dun...@gmail.com writes: - uvector, storablevector and vector are all designed for dealing with arrays. They *can* be used for characters/word8s but are not specialized for that purpose, do not deal with Unicode at all, and are probably worse at it. They are better

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-08 Thread Claus Reinke
uvector is, if my memory serves me correctly, a fork of the vector library. It uses modern stream fusion, but is under active development and is a little scary. I'm a little unclear on the exact difference between uvector and vector. Both use arrays that are not pinned, so they can't be readily

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-08 Thread Roman Leshchinskiy
On 09/03/2009, at 11:47, Claus Reinke wrote: Btw, have any of the Haskell array optimization researchers considered fixpoints yet? This, for instance, is a very nice paper: http://www.pllab.riec.tohoku.ac.jp/~ohori/research/OhoriSasanoPOPL07.pdf However, in the context of high-performance

[Haskell-cafe] bytestring vs. uvector

2009-03-07 Thread Alexander Dunlap
Hi all, For a while now, we have had Data.ByteString[.Lazy][.Char8] for our fast strings. Now we also have Data.Text, which does the same for Unicode. These seem to be the standard for dealing with lists of bytes and characters. Now we also have the storablevector, uvector, and vector packages.

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-07 Thread Bryan O'Sullivan
On Sat, Mar 7, 2009 at 10:23 PM, Alexander Dunlap alexander.dun...@gmail.com wrote: Hi all, For a while now, we have had Data.ByteString[.Lazy][.Char8] for our fast strings. Now we also have Data.Text, which does the same for Unicode. These seem to be the standard for dealing with lists of

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-07 Thread Austin Seipp
Excerpts from Alexander Dunlap's message of Sun Mar 08 00:23:01 -0600 2009: For a while now, we have had Data.ByteString[.Lazy][.Char8] for our fast strings. Now we also have Data.Text, which does the same for Unicode. These seem to be the standard for dealing with lists of bytes and

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-07 Thread Austin Seipp
Excerpts from Bryan O'Sullivan's message of Sun Mar 08 00:45:03 -0600 2009: uvector is, if my memory serves me correctly, a fork of the vector library. It uses modern stream fusion, but is under active development and is a little scary. I'm a little unclear on the exact difference between

Re: [Haskell-cafe] bytestring vs. uvector

2009-03-07 Thread Don Stewart
bos: On Sat, Mar 7, 2009 at 10:23 PM, Alexander Dunlap alexander.dun...@gmail.com wrote: Hi all, For a while now, we have had Data.ByteString[.Lazy][.Char8] for our fast strings. Now we also have Data.Text, which does the same for Unicode. These seem to be the standard