
And of course the biggest reason for this change, is we want GHC to continue
to become "smarter". Remember, Haskell is a high level language. The
original promise, is that the code should be algebraically optimizable by
the compiler itself. Yes, of course many Haskell coders have learned to
deal with the places where Haskell is all to close to the metal. But we
hope that this will not always be the case. The interesting part, may not
be that you can add the pragma yourself, but that in the future, you won't
have to change anything at all.
Tim
---------- Původní zpráva ----------
Od: Joachim Breitner
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 (http://pp.info.uni-karlsruhe.de/%7Ebreitner)"