GHCi, version 6.10.1 crashes without message

Roman Cheplyaka roma at ro-che.info
Tue Jan 13 15:17:24 EST 2009


* Heiko Studt <studt at fmi.uni-passau.de> [2009-01-13 16:15:51+0100]
> Hi (and hello everybody),
> 
> I read the FAQ, I searched down till Nov 2008, but did not find anything.
> I hope I didn't miss a FAQ or somewhat. (If so, please apologize!)
> 
> My (freshly installed) GHCi 6.10.1 runs on Windows XP on Intel Dual Core.
> I used the .msi of the Webpage some two weeks ago.
> 
> I got some strange program as example and tried out - and my ghci died
> quitly without any helping message.
> 
> Here is the original programm:
> | f x y z = a + b*c + b + fun c 
> |   where a = x * y + z
> |         b = c * fun x
> |         c = a * b
> |         fun x = x * x + 1
> 
> For testing out in previous of this posting, the following is the very
> same and had the same problem:
> | let f x y z = a + b*c + b + fun c where {a = x * y + z; b = c * fun x; c = a * b; fun x = x * x + 1}
> 
> The query to die was "f 1 2 3".
[...]

Your program loops for the following reason:
to compute f, you need to compute c
to compute c, you need to compute b
to compute b, you need to compute c again!

Haskell cannot solve equations (or, at least, not formulated in this
way), so it understands definition of f as the rules to compute things
like a, b, c. No wonder evaluation of f never terminates.

-- 
Roman I. Cheplyaka :: http://ro-che.info/
"Don't let school get in the way of your education." - Mark Twain


More information about the Glasgow-haskell-users mailing list