Infinite loop in an error message
Dimitur Krustev
dkrustev@hotmail.com
Mon, 22 Jan 2001 13:22:37
The following script causes an infinite loop when printing the error message
provoked by the evaluation of main. Tested with Hugs98 February 2000, both
in +98 and -98 mode.
>type E s = [T s]
>data T s = S s | SE (E s) deriving (Show, Eq)
>p (S s1) (S s2) | s1==s2 = True
>p t1 (SE e2) = all (q t1) e2
>-- p _ _ = error "error in p"
>q t1 t2 = if p t1 t2 then True else p t2 t1
>f (x:xs) (y:ys) | p x y = 1
>f _ _ = 2
>main = f [S "a"] [SE [S "b"]]
Main> main
Program error: {p (Make.Eq (instEq_v23_v1175 instEq_v14) (Eq_default_==
(Make.Eq
(instEq_v23_v1175 instEq_v14) (Eq_default_== (Make.Eq (instEq_v23_v1175
instEq_
v14) (Eq_default_== (Make.Eq (instEq_v23_v1175 instEq_v14) (Eq_default_==
(Make.
...{Interrupted!}
Uncommenting the last line in the definition of p fixes the problem, of
course.
(Although the script is quite contrived, it has been derived from a larger
and more realistic program.)
Best regards,
Dimitur
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.