Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-22 Thread Thomas Schilling
On 22 feb 2008, at 08.18, Jules Bean wrote: Thomas Schilling wrote: On 21 feb 2008, at 18.35, Johan Tibell wrote: I switched from lazy bytestrings to a left fold in my networking code after reading what Oleg wrote about streams vs folds. No problems with handles, etc. anymore. Do you

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-22 Thread Johan Tibell
On Fri, Feb 22, 2008 at 9:31 AM, Thomas Schilling [EMAIL PROTECTED] wrote: On 22 feb 2008, at 08.18, Jules Bean wrote: You can't call a stream-abstraction utility using a left-fold- enumerator without cheating (unsafeInterleave), because the stream- abstraction is incompatible (and

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Johan Tibell
Hi John! On Wed, Feb 20, 2008 at 3:39 PM, John Goerzen [EMAIL PROTECTED] wrote: 3) Would it make sense to base as much code as possible in the Haskell core areound ListLike definitions? Here I think of functions such as lines and words, which make sense both on [Char] as well as

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Duncan Coutts
On Wed, 2008-02-20 at 19:01 -0600, John Goerzen wrote: On Wednesday 20 February 2008 5:13:34 pm Duncan Coutts wrote: On Wed, 2008-02-20 at 08:39 -0600, John Goerzen wrote: * The iconv library works only on lazy ByteStrings, and does not handle Strings or strict ByteStrings There

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Duncan Coutts
On Thu, 2008-02-21 at 10:06 +0100, Johan Tibell wrote: Hi John! On Wed, Feb 20, 2008 at 3:39 PM, John Goerzen [EMAIL PROTECTED] wrote: 3) Would it make sense to base as much code as possible in the Haskell core areound ListLike definitions? Here I think of functions such as

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Duncan Coutts
On Thu, 2008-02-21 at 05:07 +0100, Henning Thielemann wrote: As long as it is only about speeding up list processing, one might also consider this as optimization problem. This could be handled without adapting much List based code in applications to a generic sequence class. That is, if I

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Henning Thielemann
On Thu, 21 Feb 2008, Duncan Coutts wrote: On Thu, 2008-02-21 at 05:07 +0100, Henning Thielemann wrote: As long as it is only about speeding up list processing, one might also consider this as optimization problem. This could be handled without adapting much List based code in

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Johan Tibell
On Thu, Feb 21, 2008 at 11:37 AM, Duncan Coutts [EMAIL PROTECTED] wrote: On Thu, 2008-02-21 at 10:06 +0100, Johan Tibell wrote: Hi John! On Wed, Feb 20, 2008 at 3:39 PM, John Goerzen [EMAIL PROTECTED] wrote: 3) Would it make sense to base as much code as possible in the Haskell

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Thomas Schilling
On 21 feb 2008, at 15.26, Devin Mullins wrote: On Thu, Feb 21, 2008 at 10:21:50AM +, Duncan Coutts wrote: So I'm claiming that the single impl with boundary conversion gives us the best of both worlds, no code bloat due to specialisation and working with whichever string type you like,

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Johan Tibell
On Thu, Feb 21, 2008 at 5:51 PM, Thomas Schilling [EMAIL PROTECTED] wrote: I know of an example off-hand: http://nominolo.blogspot.com/2007/05/networkhttp-bytestrings.html (Of course, as I read that, I see that the lazy code is different from the strict code, but I'll just ignore

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Thomas Schilling
On 21 feb 2008, at 18.35, Johan Tibell wrote: I switched from lazy bytestrings to a left fold in my networking code after reading what Oleg wrote about streams vs folds. No problems with handles, etc. anymore. Do you fold over chunks? Can you continue to use Parsek or other utilities

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Duncan Coutts
On Thu, 2008-02-21 at 13:37 +0100, Johan Tibell wrote: I would be very happy if people didn't use the .Char8 versions of ByteString except for being able to write byte literals using pack. (I would be even happier if Haskell had byte literals.) If people start using ByteString in their

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Johan Tibell
On Thu, Feb 21, 2008 at 6:58 PM, Thomas Schilling [EMAIL PROTECTED] wrote: On 21 feb 2008, at 18.35, Johan Tibell wrote: I switched from lazy bytestrings to a left fold in my networking code after reading what Oleg wrote about streams vs folds. No problems with handles, etc.

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Duncan Coutts
On Thu, 2008-02-21 at 13:34 +0100, Henning Thielemann wrote: I suppose we mean the same. My question is: Why do we use ByteString instead of [Word8] ? Entirely because of efficiency, right? So if we could stick to List code and only convert to ByteString at the end and the compiler all

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-21 Thread Jules Bean
Thomas Schilling wrote: On 21 feb 2008, at 18.35, Johan Tibell wrote: I switched from lazy bytestrings to a left fold in my networking code after reading what Oleg wrote about streams vs folds. No problems with handles, etc. anymore. Do you fold over chunks? Can you continue to use Parsek

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-20 Thread Henning Thielemann
Now, to help solve this problem, I wrote ListLike[2], providing a set of typeclasses that make list operations generic. I also provided default instances of ListLike for: ListLike Data.ByteString.ByteString Word8 ListLike Data.ByteString.Lazy.ByteString Word8 ListLike [a] a (Integral i,

[Haskell-cafe] The Proliferation of List-Like Types

2008-02-20 Thread John Goerzen
Hi folks, Before I started using Haskell, I used OCaml for a spell. One of my biggest annoyances with OCaml was that it had two list types: the default list (strict), and a lazy list (known as a stream). This led to all sorts of annoyances. Libraries were always written to work with one list

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-20 Thread Ross Paterson
On Wed, Feb 20, 2008 at 08:39:13AM -0600, John Goerzen wrote: I am concerned that the same thing is happening in Haskell. We now have three common list-like types: the regular list, strict ByteString, and lazy ByteString. This has created some annoying situations. For instance, a

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-20 Thread Duncan Coutts
On Wed, 2008-02-20 at 08:39 -0600, John Goerzen wrote: * The iconv library works only on lazy ByteStrings, and does not handle Strings or strict ByteStrings There is a very good reason for this. The right solution in this particular example is not to overload every internal string

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-20 Thread John Goerzen
On Wednesday 20 February 2008 5:13:34 pm Duncan Coutts wrote: On Wed, 2008-02-20 at 08:39 -0600, John Goerzen wrote: * The iconv library works only on lazy ByteStrings, and does not handle Strings or strict ByteStrings There is a very good reason for this. The right solution in this

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-20 Thread Roman Leshchinskiy
John Goerzen wrote: I am concerned that the same thing is happening in Haskell. We know have three common list-like types: the regular list, strict ByteString, and lazy ByteString. Why do you consider ByteString to be list-like but not arrays? 1) Does everyone agree with me that we have a

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-20 Thread Henning Thielemann
On Thu, 21 Feb 2008, Roman Leshchinskiy wrote: John Goerzen wrote: 2) Would it make sense to make ListLike, or something like it, part of the Haskell core? I don't think ListLike is the right approach. It's basically a fairly arbitrary collection of functions. It would be preferable,

Re: [Haskell-cafe] The Proliferation of List-Like Types

2008-02-20 Thread John Goerzen
On Wednesday 20 February 2008 8:42:56 pm Roman Leshchinskiy wrote: John Goerzen wrote: I am concerned that the same thing is happening in Haskell. We know have three common list-like types: the regular list, strict ByteString, and lazy ByteString. Why do you consider ByteString to be