Why are strings linked lists?

John Meacham john at repetae.net
Thu Nov 27 23:49:56 EST 2003


On Thu, Nov 27, 2003 at 10:54:11PM -0500, ajb at spamcop.net wrote:
> OK, to be fair, it does make string-to-string operations a bit more
> convenient.  Apart from undergraduate homework exercises and some
> specific domains, though, this isn't exactly the "common case" of
> all situations where people want strings.
> 
> 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 also have wondered how much the string representation hurts haskell
program performance.. Something I'd like to see (perhaps a bit less
drastic) would be a String class, similar to Num so string constants
would have type 
String a => a 

then we can make [Char], PackedString, and whatnot instances. It should
at least make working with alternate string representations easier.
        John

-- 
---------------------------------------------------------------------------
John Meacham - California Institute of Technology, Alum. - john at foo.net
---------------------------------------------------------------------------


More information about the Haskell mailing list