Unwanted eta-expansion
Joachim Breitner
mail at joachim-breitner.de
Mon Oct 10 10:58:36 CEST 2011
Hi,
Am Dienstag, den 04.10.2011, 09:39 +0300 schrieb Roman Cheplyaka:
> Suppose I want a foldl which is evaluated many times on the same
> list but with different folding functions.
I used this pattern successfully in SAT-Britney, where I generate a huge
list quite quickly, and I don’t want this list to stay in memory. I had
to pay a lot of attention to sharing, e.g. by making sure the parameters
to the function that generate the left fold are only passed when the
folding functions are also given, see in
http://git.nomeata.de/?p=sat-britney.git;a=commitdiff;h=e8a1eea156b76d76729a0ae55dbd7ac244f03470;hp=3bf044025665e3c7a925ca38cdcb945a103c9e6f
the changes to TransRules.hs. Otherwise, I’d get a huge thunk of
closures representing the list, as Jan-Willem predicted.
Note that I want to achieve something differently than you, unless I am
mistaken: In my case, I want to make sure the list can be fused or at
least immediately garbage-collected with every use, even if the code
that calculates the list has to be run multiple times.
Greetings,
Joachim
--
Joachim "nomeata" Breitner
mail at joachim-breitner.de | nomeata at debian.org | GPG: 0x4743206C
xmpp: nomeata at joachim-breitner.de | http://www.joachim-breitner.de/
-------------- 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/glasgow-haskell-users/attachments/20111010/20a36e1d/attachment.pgp>
More information about the Glasgow-haskell-users
mailing list