Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Re: Y Combinator



On Friday 06 February 2009 19:51:14 John Fremlin wrote:
> The main thing that puzzled me is that the type of fix is
>
> fix :: (a -> a) -> a
>
> but "a" must in fact have type
> 	b -> b
> because it's used as a function.

A clear way of defining fix is:

fix f = f (fix f)

The type of the result of fix is clearly the same type as the result of f.  
Since the result of fix is passed as the argument of f, the type of of the 
argument must also be the same.  If the type of f is a -> a, then the type of 
fix must be (a -> a) -> a.

BTW: Wouldn't a discussion of higher order functions be better suited to the 
TSAC list?

Travis


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links