Re: [Haskell-cafe] Rewrite thunk action rule?

2008-12-22 Thread Dan Weston
Peter Todd wrote: Not quite. If I have a thunk, at the low level somewhere it must refer to the transform function, the transform matrix, and the element that is to be transformed. If I apply another transform to that unevaluated thunk, my understanding is that haskell will represent it as such:

[Haskell-cafe] Rewrite thunk action rule?

2008-12-21 Thread Peter Todd
I have a program with this data structure: data Element = Element { elementOrigin :: V, elementSubs :: [Element] } and this important bit of code that operates on it: transform :: T - Element - Element transform t e = Element { elementOrigin = tmulv t

Re: [Haskell-cafe] Rewrite thunk action rule?

2008-12-21 Thread Luke Palmer
2008/12/21 Peter Todd p...@petertodd.org If I could somehow arrange for the transform function to detect when it is being applied to a unevaluated thunk, and then modify the thunk in place, that would basically be the behavior I need. Any suggestions? That is exactly what is already

Re: [Haskell-cafe] Rewrite thunk action rule?

2008-12-21 Thread Peter Todd
On Sun, Dec 21, 2008 at 02:56:06AM -0700, Luke Palmer wrote: 2008/12/21 Peter Todd p...@petertodd.org If I could somehow arrange for the transform function to detect when it is being applied to a unevaluated thunk, and then modify the thunk in place, that would basically be the behavior I

Re: [Haskell-cafe] Rewrite thunk action rule?

2008-12-21 Thread Luke Palmer
On Sun, Dec 21, 2008 at 10:27 AM, Peter Todd p...@petertodd.org wrote: data Element = Element { elementOrigin :: V, elementSubs :: [Element] } | ElementThunk T Element transform :: T - Element - Element transform t (ElementThunk t2 e) = ElementThunk (tmul t t2) e transform