[Haskell-cafe] A first glimps on the {-# NOUPDATE #-} pragma
Joachim Breitner
breitner at kit.edu
Wed Aug 29 16:21:12 CEST 2012
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120829/e12bc965/attachment.pgp>
More information about the Haskell-Cafe
mailing list