Pattern match failure, then inconsistent function

Hi, I am getting a "pattern match failure", and then subsequent functions which worked right work wrong. I am using Hugs and Trex. While most of the other functions work fine, the function "findCoordinatesUtil" generates an error, then misbehaves; it takes a record and searches a list of records to find other records in a specified relationship with the input function. In the first example, it works fine: LexicalSemantics03> findCoordinatesUtil (giveActionFromLabel "Action6" testLexActions03) testLexActions03 [(label="Action7", xcond=["prop1","prop7","prop5"], ycond=["prop3","pr op4","neg-prop6"]),(label="Action08", xcond=["prop1","prop7","prop5"], ycond=["prop3","neg-prop6","prop5"]),(label="Action09", xcond=["prop1 ","prop7","prop5"], ycond=["prop3","neg-prop6","neg-prop1"])] However, when I run the function on a larger list of records (here testList01), it generates an error message. LexicalSemantics03> findCoordinatesUtil (giveActionFromLabel "Action33 " testList01) testList01 Program error: pattern match failure: map_v780 (instEq_v20 instEq_v11 Eq_== "neg-prop2") map_v780 INTERNAL ERROR: Error in graph Moreover, when I subsequently run the function, I get a different (and wrong) result -- label-"Action08" is missing. LexicalSemantics03> findCoordinatesUtil (giveActionFromLabel "Action6" testLexActions03) testLexActions03 [(label="Action7", xcond=["prop1","prop7","prop5"], ycond=["prop3","pr op4","neg-prop6"]),(label="Action09", xcond=["prop1","prop7","prop5"], ycond=["prop3","neg-prop6","neg-prop1"])] When I reload the module, it correctly works again. LexicalSemantics03> :r LexicalSemantics03> findCoordinatesUtil (giveActionFromLabel "Action6" testLexActions03) testLexActions03 [(label="Action7", xcond=["prop1","prop7","prop5"], ycond=["prop3","pr op4","neg-prop6"]),(label="Action08", xcond=["prop1","prop7","prop5"], ycond=["prop3","neg-prop6","prop5"]),(label="Action09", xcond=["prop1 ","prop7","prop5"], ycond=["prop3","neg-prop6","neg-prop1"])] I don't understand the pattern match failure or how to correct it. What is this error message telling me? Thanks, Adam Wyner

Adam Wyner
I am getting a "pattern match failure", and then subsequent functions which worked right work wrong. I am using Hugs and Trex.
INTERNAL ERROR: Error in graph it means that the whole internal evaluation context has become corrupted. Any further use of the reduction graph (representing the
The problem with subsequent evaluations is simple. When Hugs says this: program) is likely to give wrong answers. Reloading the program code wipes the internal graph and starts again. Normally, when someone gets an error message (like "pattern-match failure"), they go and fix the program immediately, then reload, which is why few people complain about the cascading-errors behaviour.
Program error: pattern match failure: map_v780 (instEq_v20 instEq_v11 Eq_== "neg-prop2") map_v780
The pattern-match failure seems to be in an expression looking something like map (== "neg-prop2") xs and I think the problem is possibly in an "instance Eq" you have written by hand for one of your datatypes. "Pattern-match failure" means that you have not covered all the possible patterns in your definition. This might either be on the LHS of the defn, or in a case expression on the RHS. Regards, Malcolm

On Mon, Aug 22, 2005 at 03:31:24PM +0100, Adam Wyner wrote:
I am getting a "pattern match failure", and then subsequent functions which worked right work wrong. I am using Hugs and Trex. While most of the other functions work fine, the function "findCoordinatesUtil" generates an error, then misbehaves; it takes a record and searches a list of records to find other records in a specified relationship with the input function. [...] However, when I run the function on a larger list of records (here testList01), it generates an error message.
LexicalSemantics03> findCoordinatesUtil (giveActionFromLabel "Action33 " testList01) testList01
Program error: pattern match failure: map_v780 (instEq_v20 instEq_v11 Eq_== "neg-prop2") map_v780 INTERNAL ERROR: Error in graph
This lokks like a memory management bug in Hugs, leaving the heap corrupted so that further results are unreliable. Please send in the full program that triggers this, plus details of the Hugs version you're using.
participants (3)
-
Adam Wyner
-
Malcolm Wallace
-
Ross Paterson