[Haskell-cafe] Re: [Haskell] Fixpoint combinator without recursion

Jan-Willem Maessen jmaessen at alum.mit.edu
Wed Apr 4 21:47:13 EDT 2007


On Apr 4, 2007, at 5:01 PM, Edsko de Vries wrote:

>> Yeah, it's rather cool. IIRC, this style of encoding of recursion
>> operators is attributed to Morris.
>
> Do you have a reference?
>
>> Before the advent of equality coercions, GHC typically had problems
>> generating code for these kinds of definitions. Did you test this
>> with a release version? If so, how did you get around the code-
>> generation problem? Is it the NOINLINE pragma that does the trick?
>
> Yep. Without the NOINLINE pragma, ghc tries to inline the  
> definition of
> fac, expanding it ad infinitum (this is a known bug in ghc and  
> mentioned
> in the ghc manual). Hugs doesn't have a problem though.

I keep waiting for someone to use this fact to cook up a poor man's  
partial evaluation---use fix for static recursion, and ordinary  
recursive definitions for dynamic recursion.  I fiddled with this a  
bit in the pH days (it had the same bug, for much the same reason).

-Jan-Willem Maessen

>
> Edsko
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2425 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070404/9120d87f/smime.bin


More information about the Haskell-Cafe mailing list