Re: Revert a CAF?

2011-12-09 Thread wren ng thornton
support reverting CAFs in interpreted code at the moment, you have to reload the module. So you need the following things: - modify the GC to revert CAFs when they become garbage - add a primop to revert a single CAF not too hard, I would think... Good to know. I'll take a look at it over

Re: Revert a CAF?

2011-12-08 Thread Simon Marlow
On 07/12/11 15:16, Twan van Laarhoven wrote: On 06/12/11 18:48, wren ng thornton wrote: So, I have an optimization/internals question. Does the GHC API have any hooks for being able to revert a CAF to the original expression, thus discarding the previously computed result? ... I could hack

Re: Revert a CAF?

2011-12-07 Thread Simon Marlow
On 06/12/2011 17:48, wren ng thornton wrote: So, I have an optimization/internals question. Does the GHC API have any hooks for being able to revert a CAF to the original expression, thus discarding the previously computed result? The reason I'm wanting this is that I have a particular CAF

Re: Revert a CAF?

2011-12-07 Thread Twan van Laarhoven
On 06/12/11 18:48, wren ng thornton wrote: So, I have an optimization/internals question. Does the GHC API have any hooks for being able to revert a CAF to the original expression, thus discarding the previously computed result? ... I could hack something together based on unsafePerformIO

Revert a CAF?

2011-12-06 Thread wren ng thornton
So, I have an optimization/internals question. Does the GHC API have any hooks for being able to revert a CAF to the original expression, thus discarding the previously computed result? The reason I'm wanting this is that I have a particular CAF which is an infinite list. Unfolding that list

RE: Revert a CAF?

2011-12-06 Thread Simon Peyton-Jones
| Subject: Revert a CAF? | | So, I have an optimization/internals question. Does the GHC API have any | hooks for being able to revert a CAF to the original expression, thus | discarding the previously computed result? | | The reason I'm wanting this is that I have a particular CAF which

Re: Revert a CAF?

2011-12-06 Thread John Meacham
Can you use a weak pointer to do what you want? If you keep a weak pointer to the head of your expensive list then itwill be reclaimed at the next major GC I believe. I have used weakpointers for vaugely similar purposes before. I guess a downside is that they will always be reclaimed on GC even