Heiko Studt wrote:
PPS: Why does your mailinglist not set the Reply-To header?
@Roman Cheplyaka: Sorry for double mailing.
Am 13.01.2009 schrieb Roman Cheplyaka:
| 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.
The problem is not it does not terminate. It terminates. GHCi terminates
inclusivly (maybe by simpathy? ;-)). As Chris Smith wrote it faults the
stack.
I tried to get the thing some smaller and therefor to the point,
I should have done this before I assume:
| let f = c where {c = c}
at "f",
| let f = f in f
kills GHCi immidiatelly.
| let f 0 = f 0 in f 0
simply does not terminate (as it should be).
See
http://hackage.haskell.org/trac/ghc/ticket/2783
and
http://hackage.haskell.org/trac/ghc/ticket/2786
Cheers,
Simon
_______________________________________________
Glasgow-haskell-users mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users