[Haskell-cafe] A first glimps on the {-# NOUPDATE #-} pragma

timothyhobbs at seznam.cz timothyhobbs at seznam.cz
Wed Aug 29 16:34:05 CEST 2012


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 <breitner at kit.edu>
Datum: 29. 8. 2012
Předmět: Re: [Haskell-cafe] A first glimps on the {-# NOUPDATE #-} pragma
"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
(http://pp.info.uni-karlsruhe.de/%7Ebreitner)"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120829/99c3150f/attachment.htm>


More information about the Haskell-Cafe mailing list