
Am Mittwoch, 1. Oktober 2003, 15:18 schrieb Petter Egesund:
[...]
The problem is of course that the string is copied each time I do a substitute, and I wonder if a more experienced haskeller has a better solution to my problem.
It doesn't have to be a problem that the string is copied each time. If you have, e.g., functions f1, f2, ..., fn :: String -> String and do something like f1 (f2 (... (fn string)...)) then string and the intermediate data can be removed by the garbage collector as soon as they are not needed. Unfortunately, from your message it's not very clear to me what exactly you mean, and, unfortunately again, I'm not an expert in Haskell memory management.
I have myself considered these solutions, but they all seems non-elegant; [...]
Indeed, they all look very non-elegant, and I think, there is a better solution.
Cheers,
Petter Egesund
Wolfgang