[Haskell-cafe] Re: Why purely in haskell?
Cristian Baboi
cristi at ot.onrc.ro
Fri Jan 11 09:04:55 EST 2008
The thing is that y already is a *builtin* function in Haskell.
On Fri, 11 Jan 2008 15:59:50 +0200, Achim Schneider <barsoap at web.de> wrote:
> "Cristian Baboi" <cristi at ot.onrc.ro> wrote:
>>
>> >> So let's imagine:
>> >>
>> >> ones = 1 : ones
>> >>
>> >> ones' = repeat 1
>> >> where repeat n = n : repeat n
>>
>> (==) :: Eq a => a -> a -> Bool
>>
>> -- what is (y (y) ) by the way ?
>> -- how about ( y id ) ?
>>
>> y f = f (y f).
>>
>> ones :: Num a => [a]
>> ones = y (1 :)
>>
>> repeat :: a -> [a]
>> repeat = \n -> y (n:)
>>
>> ones' :: Num a => [a]
>> ones' = repeat 1 = (\n->y(n:)) 1 = y (1 : )
>>
>> To be able to test them for equality, we must have Eq a.
>>
>> So, the reason we cannot test them for equality is that we cannot
>> test y (a : ) == y (a : ) where a == a is testable.
>>
> Yes, thanks. I actually do think that many things would be easier if
> every recursion would be translated to its fixpoint, making the term
> tree completely finite and defining y internal, as it's arcane, black
> magic.
>
________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
part000.txt - is OK
http://www.eset.com
More information about the Haskell-Cafe
mailing list