Why are strings linked lists?

Graham Klyne GK at ninebynine.org
Sat Nov 29 12:51:10 EST 2003


At 16:56 28/11/03 -0500, Mark Carroll wrote:
>(shifting to Haskell-Cafe)
>
>On Fri, 28 Nov 2003, Donald Bruce Stewart wrote:
>
> > ajb:
>(snip)
> > > As a matter of pure speculation, how big an impact would it have if, in
> > > the next "version" of Haskell, Strings were represented as opaque types
> > > with appropriate functions to convert to and from [Char]?  Would there be
> > > rioting in the streets?
>
>I'd be sad to lose some convenient list-based string type because I make a
>lot of use of the fact that strings are lists in processing them.

+1

Following this debate, I find myself wondering if this is not something 
that might be optimized "behind the scenes" as a common case, rather than 
changing the computational model presented.

I use strings a lot, and thus far I've not been aware that they've been a 
performance problem for me.

#g
--

> > You could look at GHC's FastString representation (used internally).
> > It is in $fptools/ghc/compiler/utils/FastString.lhs
>
>It does make sense to have a rather faster form of string conveniently
>available in /some/ form.
>
>-- Mark
>_______________________________________________
>Haskell-Cafe mailing list
>Haskell-Cafe at haskell.org
>http://www.haskell.org/mailman/listinfo/haskell-cafe

------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact



More information about the Haskell-Cafe mailing list