[Haskell-cafe] Re: flip fix and iterate

Pete Kazmier pete-expires-20070513 at kazmier.com
Wed Mar 21 07:35:27 EDT 2007


"Claus Reinke" <claus.reinke at talk21.com> writes:

>> I won't try to understand fix just yet, but I'm still confused by
>> the type of fix:
>>     fix :: (a -> a) -> a
>> It appears to me that it takes a function as an argument, and that
>> function takes a single argument.  So how are you passing fix an
>> anonymous function taking 2 arguments?  Sorry if I have beaten this
>> horse to death, but my pea-sized brain is working overtime here.
>
> fix takes a function as an argument, and that function takes a
> single argument.  that function also returns something of the same
> type as its single argument.  

[snip]

> and suddenly, fix does have two parameters, which flip can flip!-)
>
> no magic, just technology sufficiently advanced to be
> indistinguishable from it: a function of one parameter, which
> returns a function of one parameter, is a function of more than one
> parameter.
>
> at which point this particular fixed-point combinator puts its
> recursive unfoldings to rest for tonight.

Claus,

Thank you for the detailed explanation.  I think I understand now!  To
be sure, I'll reread your post several times over the next few days.

Thanks again, this was very helpful.



More information about the Haskell-Cafe mailing list