[Haskell-cafe] Re: CAF's in Haskell

2007-12-27 Thread Jon Fairbairn
"Neil Mitchell" <[EMAIL PROTECTED]> writes: > I should have been more precise with my question. Given the code: > > fred = 2 + 2 > > bob = fred + fred > > In a Haskell implementation fred would be evaluated once to 4, then > used twice. The 2+2 would only happen once (ignore defaulting and > overlo

Re: [Haskell-cafe] Re: CAF's in Haskell

2007-12-26 Thread Jonathan Cast
On 26 Dec 2007, at 12:30 PM, Peter Verswyvelen wrote: Well I certainly hope the standard defines that both fred and bob will only be evaluated once, because my programs depend on that :) If your programs depend on lazy evaluation, they can't be Haskell 98. Any complete reduction method is

Re: [Haskell-cafe] Re: CAF's in Haskell

2007-12-26 Thread Benja Fallenstein
Hi Neil, On Dec 26, 2007 7:16 PM, Neil Mitchell <[EMAIL PROTECTED]> wrote: > Given the code: > > fred = 2 + 2 > > bob = fred + fred > > In a Haskell implementation fred would be evaluated once to 4, then > used twice. The 2+2 would only happen once (ignore defaulting and > overloaded numerics for

RE: [Haskell-cafe] Re: CAF's in Haskell

2007-12-26 Thread Peter Verswyvelen
Well I certainly hope the standard defines that both fred and bob will only be evaluated once, because my programs depend on that :) Peter Neil wrote: > fred = 2 + 2 > bob = fred + fred > In a Haskell implementation fred would be evaluated once to 4, then > used twice. The 2+2 would only happen

Re: [Haskell-cafe] Re: CAF's in Haskell

2007-12-26 Thread Neil Mitchell
Hi > > Are CAF's specified in the Haskell report? I couldn't find them mentioned. > > CAF is a term of art. If you define > > fred = 2 + 2 > > that's a CAF. I should have been more precise with my question. Given the code: fred = 2 + 2 bob = fred + fred In a Haskell implementation fred would b

[Haskell-cafe] Re: CAF's in Haskell

2007-12-26 Thread Jon Fairbairn
"Neil Mitchell" <[EMAIL PROTECTED]> writes: > Hi, > > Are CAF's specified in the Haskell report? I couldn't find them mentioned. CAF is a term of art. If you define fred = 2 + 2 that's a CAF. > If not, why do all Haskell compilers support them? How could they not? I'm not sure I understand y