From Löb's theorem to spreadsheet evaluation
blog.sigfpe.com
blog.sigfpe.com
Is this something Haskell does in general? What happens when you try and write a function that doesn't have a fixed point?
It's like non-well founded recursion, it loops. But as a bonus, some cases are caught at runtime :
x :: String
x = x
main = print x
./x
x: <<loop>> x :: Real
x = 2 / x
Guess that's to be expected, though a bit disappointing; I think it means the "loeb" given will be a lot less broadly applicable than the general mathematical version. "It won't do logic to figure it out,..."
If it could do that, wouldn't that amount to having an oracle that can tell whether a program will terminate?No, wait, Real is actually a type class, not a type, right? Perhaps when you write that code the system should extend itself to support an infinite-precision real-number type that implements Real, and make x be exactly sqrt(2)? (And exactly -sqrt(2), of course.)
All of which is just another way of saying: I really don't think it's quite fair to be disappointed that Haskell doesn't try to solve the extremely difficult (not to say provably unsolvable) problems of "doing logic to figure it out".