Why are strings linked lists?
Wolfgang Jeltsch
wolfgang at jeltsch.net
Sat Nov 29 11:30:57 EST 2003
Am Freitag, 28. November 2003 08:49 schrieb John Meacham:
> [...]
> 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.
I think, I have already said the following on this list. I would also like to
have different character types for different subsets of Char (e.g., ASCII)
and a class Character which the different character types are instances of.
You could combine this idea with the string class idea in the following way:
class Character c => String s c | s -> c where
[...]
instance Character c => String [c] c where
[...]
instance String PackedString Char where
[...]
instance String PackedASCIIString ASCIIChar where
[...]
> John
Wolfgang
More information about the Haskell
mailing list