
Hi Facundo, Am Mittwoch, den 29.08.2012, 10:26 -0300 schrieb Facundo Domínguez:
upd_noupd n = let l = myenum' 0 n in last l + length l
This could be rewritten as
upd_noupd n = let l n = myenum' 0 n in last (l n) + length (l n)
Or a special form of let could be introduced to define locally-scoped macros:
upd_noupd n = let# l = myenum' 0 n in last l + length l
What's the strength of the {-# NOUPDATE #-} approach?
it does not require refactoring of the code. There is not always a parameter handy that you can use to prevent sharing, and using () for that sometimes fails due to the full-lazyness-transformation. And a locally-scoped macros would not help in this case: test g n = g (myenum' 0 n) Now you still might want to prevent the long list to be stored, but here it cannot be done just by inlining or macro expansion. Greetings, Joachim -- Dipl.-Math. Dipl.-Inform. Joachim Breitner Wissenschaftlicher Mitarbeiter http://pp.info.uni-karlsruhe.de/~breitner