Optimization & Destructive Updates

I was just musing the other day about the possibility of allowing (efficient and transparent) destructive updates in certain situations. Take the following (giberish) example: f xs = g xs [] where g [] ac = ac g (x1:x2:xs) ac = g xs (ac ++ [x2,x1]) It seems to me that the list concatenation in the tail recursion call can be safely performed destructively. Does anybody know about any research going on in this area? (Mind you: no linear types, no monads, only `under the hood' compiler optimization.) I'm aware of the fact that this would imply another kind of overloading (destructive vs. non-destructive) for functions which also seems an interesting research area. Regards, -- Lajos Nagy Computer Science Ph.D. Student, Florida Institute of Technology

I am interested in better understanding what optimizations of this sort GHC performs. I second Lajos's question. I sometimes write code using StateMonad, and expect some destructive updates. Judging by the performance of the resulting executable, the updates are nondestructive. (But, no, I haven't verified this by examining the object code.) -- Robin Bate Boerop On 14-Apr-06, at 12:25 PM, Lajos Nagy wrote:
I was just musing the other day about the possibility of allowing (efficient and transparent) destructive updates in certain situations. Take the following (giberish) example:
f xs = g xs [] where g [] ac = ac g (x1:x2:xs) ac = g xs (ac ++ [x2,x1])
It seems to me that the list concatenation in the tail recursion call can be safely performed destructively. Does anybody know about any research going on in this area? (Mind you: no linear types, no monads, only `under the hood' compiler optimization.)
I'm aware of the fact that this would imply another kind of overloading (destructive vs. non-destructive) for functions which also seems an interesting research area.
Regards,
-- Lajos Nagy Computer Science Ph.D. Student, Florida Institute of Technology
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On Apr 14, 2006, at 12:25 PM, Lajos Nagy wrote:
I was just musing the other day about the possibility of allowing (efficient and transparent) destructive updates in certain situations. Take the following (giberish) example:
f xs = g xs [] where g [] ac = ac g (x1:x2:xs) ac = g xs (ac ++ [x2,x1])
It seems to me that the list concatenation in the tail recursion call can be safely performed destructively. Does anybody know about any research going on in this area? (Mind you: no linear types, no monads, only `under the hood' compiler optimization.)
I'm aware of the fact that this would imply another kind of overloading (destructive vs. non-destructive) for functions which also seems an interesting research area.
http://portal.acm.org/citation.cfm?id=99375&dl=GUIDE&coll=GUIDE Its a little old, but covers some interesting ground.
Regards,
-- Lajos Nagy Computer Science Ph.D. Student, Florida Institute of Technology
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Speak softly and drive a Sherman tank. Laugh hard; it's a long way to the bank. -- TMBG
participants (3)
-
Lajos Nagy
-
Robert Dockins
-
Robin Bate Boerop