[Haskell-cafe] The Proliferation of List-Like Types
Thomas Schilling
nominolo at googlemail.com
Thu Feb 21 11:51:41 EST 2008
On 21 feb 2008, at 15.26, Devin Mullins wrote:
> On Thu, Feb 21, 2008 at 10:21:50AM +0000, 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, by converting it at the
>> beginning
>> and end. Of course only an experiment can say either way.
>
> I think his point is that if I'm using three libraries, each of which
> uses a different String type, that's a lot of boundaries. Perhaps
> worse
> yet, if I'm a library author and I want to be a good citizen, I
> have to
> write three versions of my code (or create my own StringLike
> typeclass).
> 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 that for the sake of, uh,
> argument.)
Yes it does use different implementations, but the lazy interface has
it's problems (leakage of handles, unclosed connections, and more).
But what we really want is, as Duncan and Roman suggested, *one*
standard, optimizable representation and conversions from and to it.
This would work perfectly well with sockets.
/ Thomas
More information about the Haskell-Cafe
mailing list